.htaccess 在htaccess中需要帮助吗
我需要我的URL如下:.htaccess 在htaccess中需要帮助吗,.htaccess,url-rewriting,.htaccess,Url Rewriting,我需要我的URL如下: http://example.com/index.php?title=about -> http://example.com/about/ 标题超过50页,同样的内容也会出现在页面上 有什么想法吗?谢谢虽然mosg的链接确实有你想要的答案,但我想解释一下你需要的部分可能会更容易 我不确定是否要将index.php?title=about重定向到/about/,或者是否希望/about/以静默方式调用index.php?title=about 对于/about/->
http://example.com/index.php?title=about -> http://example.com/about/
标题超过50页,同样的内容也会出现在页面上
有什么想法吗?谢谢虽然mosg的链接确实有你想要的答案,但我想解释一下你需要的部分可能会更容易 我不确定是否要将index.php?title=about重定向到/about/,或者是否希望/about/以静默方式调用index.php?title=about 对于
/about/
->/index.php?title=about
(无提示):
对于/index.php?title=about
->/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
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/