【发布时间】:2015-12-07 16:37:04
【问题描述】:
在 codeignitor .htaccess 中,我正在尝试 301 将旧的/未使用的 url 重定向到新的目录/页面 - 但无论我做什么,它都会添加一个问号作为 adirecty...如果我从.htaccess ....它仍然在url加上旧路径中添加问号...
我在下面包含了我的代码:
RewriteBase /
# Remove trailing slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [R=301,L]
# Actually 301 direct all index.php requests
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
# this gets rid of index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Redirect 301 /old-page /newdir/new-page/?
如果我要进入:
/old-page > 会去 >>> /newdir/new-page/?/
或者如果我从 e.htaccess 中去掉问号,那将是......
/newdir/new-page/?/old-page
当我想要的时候......
/newdir/new-page
希望有人能帮忙
【问题讨论】:
标签: .htaccess codeigniter redirect