I understand it isn't original question but I have read several posts and questions here but still can't decipher it.
I am on localhost (apache server) and default server house is in /var/www. There's a folder 'project' with several subfolders, one of these is known as web with index.php file. Now if I wish to visit index, I have to use full url localhost/project/web/.
I wish to allow it to be better to ensure that if put forth localhost/project you're either rerouted to localhost/project/web/ or even the url remains same however it works (sorry with this naive formulation).
Inshtaccess I transformed directory index however all links (being that they are relative) weren't working.
I attempted this .htaccess in /var/www/project:
RedirectMatch permanent ^/$ ./web/ <Files .htaccess> order allow,deny deny from all </Files> Options -Indexes
But it is no longer working, likely to localhost/project attempts to list the project directory (it's not permitted because of Options -Indexes, that is things i wanted). I want so that it is in addition to the 'localhost' in url since it need to work anywhere (if .htaccess is permitted)
Thank you for any advice
RedirectMatch does not possess a base like mod_rewrite does. Even when it's within the htaccess file within the /project directory, you'll need the entire URI:
RedirectMatch permanent ^/project/$ /project/web/
Should you wanted it to visit /project/web/index.php without a browser redirect (meaning the address within the URL bar around the browser stays at localhost/project/) you have to internally rewrite the URI using mod_rewrite:
RewriteEngine On RewriteRule ^$ web/index.php [L]
Observe that mod_rewrite uses the bottom URI the htaccess file is within (however the "prefix" or leading slash is taken away).