1
帮助,我需要我的网址是这样的:需要htaccess的
http://example.com/index.php?title=about -> http://example.com/about/
标题超过50个,并同去的页面。
有什么想法?谢谢
帮助,我需要我的网址是这样的:需要htaccess的
http://example.com/index.php?title=about -> http://example.com/about/
标题超过50个,并同去的页面。
有什么想法?谢谢
虽然mosg的链接确实有你正在寻找的答案,但我觉得仅仅解释你需要的部分可能更容易。
我不确定是否要重定向index.php?title =关于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/
希望这有助于:)