小编Ref*_*gic的帖子

.htaccess将查询字符串附加到内部重定向

我正试图在.htaccess中创建SEO友好的蒙面重写.htaccess文件在localhost和我的个人服务器上工作正常,但遗憾的是它似乎无法在GoDaddy的服务器上运行.我知道那已经是一个问题,但是为一个使用Godaddy作为主持人的客户工作.

问题是重写似乎是强制重定向显示浏览器URL栏中重写的查询字符串而不是保持内部.例如.

规则:

RewriteRule ^/?([a-zA-Z0-9-_/]*)$ /index.php?loadPage=$1&mode=cms [L,QSA]
Run Code Online (Sandbox Code Playgroud)

链接:/images重定向到/images/?loadPage=images&mode=cms

这"应该"留/images/在浏览器中.我复制了.htaccess下面的简短文章,为开发块修改了IP

<Files .htaccess>
    deny from all
</Files>

Options -MultiViews +FollowSymlinks -Indexes

RewriteEngine On
RewriteBase /

# Stop Old redirection from block below
RewriteCond %{REQUEST_URI} "/old/"
RewriteRule (.*) $1 [L]

# Under construction Redirect
RewriteCond %{REMOTE_ADDR} !^0.0.0.0
RewriteCond %{REQUEST_URI} !^/?old/
RewriteRule ^/?(.*) “/old/$1? [L,QSA]

#Admin utilities rewrite
RewriteRule ^/?admin/?(.*)$ /index.php?loadPage=$1&mode=backend [L,QSA]

#CMS/Frontend rewrites -- this one is failing
RewriteRule ^\/?([a-zA-Z0-9-_]+)\/?$ /index.php?loadPage=$1&mode=cms [QSA,L]
Run Code Online (Sandbox Code Playgroud)

一个潜在的注意事项是显示的网址是/images/?query_stringNOT index.php?query_string …

php .htaccess mod-rewrite redirect

7
推荐指数
1
解决办法
4670
查看次数

标签 统计

.htaccess ×1

mod-rewrite ×1

php ×1

redirect ×1