Write .htaccess file to check requests from root
I have a problem with writing a .htaccess to help me handle requests from root, i.e. http://domain.com/index.php can handle users' requests to http://domain.com/abc/, which is from a child folder.
So, just to clarify, I want every time the users go to http://domain.com/abc/
, my code in http://domain.com/index.php
开发者_开发技巧 will handle the GET request as if it was http://domain.com/index.php?url=abc
.
I don't have much experience working with .htaccess, hope somebody can help me :)
Thanks.
Try this code in .htaccess file:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteRule ^(abc)/?$ index.php?url=$1 [L,NC,QSA]
Just remember that above rule will work only for URI /abc
or /abc/
.
精彩评论