vendredi 23 janvier 2015

htcaccess rewrite to subdirectory not working

Some people might get angry and irritated once I asked this question again but I can't really make it work after trying all answers I have found here and I'm a newbie at this stuff too. Anyway I have a domain (http://ift.tt/1yBPQaV) that I want to redirect to a sub directory (/var/www/html/start/index.html) so I modified the .htaccess and add the following lines below.



RewriteEngine on
RewriteRule ^$ start/index.html [L]


However when restarting apache it does not use the rewrite rule. I even tried the code below but to no avail.



# .htaccess main domain to subdirectory redirect
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/
# Don't change the following two lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]


Can somebody explain how to do this?


Thank you.


Aucun commentaire:

Enregistrer un commentaire