我已在http://www.question2answer.org/(讨论子目录)的网站上下载并安装了http://www.yourstartups.com/discussion/
当前网址结构如下:example.com/index.php?qa=123&qa_1=why-do-birds-sing 我想改成/ 123 / why-do-birds-sing (为什么鸟儿唱歌是示例查询)
以下是我的htaccess:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
&#13;
任何人都可以帮助我吗?
答案 0 :(得分:0)
您需要一条新规则来重写您漂亮的网址。
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?qa=$1&qa_1=$2 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0 [L,QSA]
</IfModule>