开发者

.htaccess query string to folder format

I have a query URL with query string and I want to convert it to folder structured URL.

For example:

http://localhost/index.php?page=about-us
http://localhost/index.php?page=contact-us

how would I covert it to

http://localhost/index/page/about-us
http://localhost/page/about-us

I know this ca开发者_JAVA技巧n be done with .htaccess. I just don't know where to start


You would need something along the lines of...

Options +FollowSymLinks   
RewriteEngine On   

RewriteCond %{SCRIPT_FILENAME} !-d   
RewriteCond %{SCRIPT_FILENAME} !-f   

RewriteRule ^page/([-a-z-0-9]+)*/$ ./index.php?page=$1
RewriteRule ^index/page/([-a-z-0-9]+)*/$ ./index.php?page=$1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜