How can I redirect localhost/s to localhost/s/web/index.php to using mod_rewrite
I'm developing a little web application, my directory structure was something like this:
htdocs/s/index.php
htdocs/s/views/
htdocs/s/vendors/
and I used this .htaccess:
<IfModule mod_rewrite.c>
Options -MultiViews
Options +FollowSymlinks
RewriteEngine On
RewriteBase /s/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
This way I can enter localhost/s/aaaa
to access at localhost/s/index.php/aaaa
. But I've changed my directory structure to something like this:
htdocs/s/web/index.php
htdocs/s/views/
htdocs/s/vendors/
And I don't know how to make the .htaccess to redirect localhost/s/aaa
to localhost/s/web/index.php/aaa.
I tried a lot of things but without result. Anybody here that knows more about .htaccess and mod_rewrite can help me?
EDIT: It seems that it's imposible to setup it with my lampp server or something like that. But how the heck people manage to make WordPress, Joomla and other CMS do it?
It's really not that important in a developing environment, but when I'll upload it to t开发者_开发百科he Internet there's to be some way that hide all the libraries and internals of the application to the web visitor. I mean everybody does it, right? So how it can be done?
EDIT 2: For some weird reason it cannot be one in my home server, so I'm back to my previous directory structure and make a nasty hack with a .htaccess with "deny For All" in the directories that want to hide. Thay'll not be a lot hidden, but I cannot find any other solution...
If rewrite rules you have provided were working fine for you, then this should work fine as well:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /s/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/index.php [QSA,L]
</IfModule>
精彩评论