旧URL到新url的RewriteRule规则在url codeigniter中添加问号

时间:2017-09-01 07:43:21

标签: php .htaccess codeigniter url-redirection

我想将residential-property/20/old_value重定向到/residential-properties/new_value,因为我在.htaccess文件中编写了代码:

RewriteEngine On
RewriteBase /


RewriteRule ^residential-property/20/old_value?$ /residential-properties/new_value? [B,NE,R=301,L,NC]

# 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]

上面的代码重定向旧网址,但它还添加?在像https://example.com.com/?/residential-properties/new_value/这样的网址中,我不想在网址中添加该问题我的错误请帮助我。提前谢谢。

0 个答案:

没有答案