我需要我的网址如下:
http://example.com/index.php?title=about -> http://example.com/about/
标题超过50,同样适用于页面。
有什么想法吗?感谢
答案 0 :(得分:2)
虽然mosg的链接确实有您正在寻找的答案,但我认为可能更容易解释您需要的部分。
我不确定你是否要重定向index.php?title = about TO / about /,或者如果你想/ about /默默地调用index.php?title = about。
/about/
- > /index.php?title=about
(默默地):
RewriteEngine on # turn on re-writing
RewriteCond %{REQUEST_URI} !^/index\.php.* # for every non-rewritten request
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php?title=$1 [L] # rewrite to index.php
/index.php?title=about
- > /about/
(不是默默地)
RewriteEngine on # turn on re-writing
RewriteCond %{REQUEST_URI} ^/index\.php?title=.* # for index.php?title=slug request
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] # rewrite to /slug/
希望这会有所帮助:)