A site of mine has all the files stored in a subdirectory. Previously, I used a 301 redirect to send visitors from site.com/specific/page
to site.com/subdirectory/specific/page
.
I am now using this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?site.com$
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdirectory/$1
RewriteCond %{HTTP_HOST} ^(www.)?site.com$
RewriteRule ^(/)?$ subdirectory/index.php [L]
This means the URL is cleaner. However, is there a way to make the htaccess redirect people using the subdirectory to the cleaner URL? i.e. if someone goes to site.com/subdirectory/specific/page
, is there a way to make the URL site.com/specific/page
, while showing the content from site.com/subdirectory/specific/page
?