url rewriting – htacess edit to redirect website in subfolder to main domain url
Question
I’ve been testing two .htaccess file in root folder and there was the same result.
(website installed in example.com/my_subdir and running using example.com)
The first one
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteCond %{REQUEST_URI} !my_subdir/
RewriteRule (.*) /my_subdir/$1 [L]
The other is
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L]
</IfModule>
Can you please tell me what is the differences and what config is better?
0
1 year
2021-11-08T11:58:36-05:00
2021-11-08T11:58:36-05:00 0 Answers
0 views
0
Leave an answer