.htaccess - 问题 301 redirect not allowing login in the backend

标签 .htaccess redirect seo

我在带有 301 重定向的 CMS 的 htaccess 中发现了一些问题。

当尝试解决规范 url(将站点重定向到 www.site)时,我遇到了无法登录后端 (www.site/admin) 的问题。

htaccess 条件是:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.site\.co.uk$
RewriteRule (.*) http://www.site.co.uk$1 [R=301,L]

我想我需要包含一个允许 URI /admin 不被重定向的表达式,但是怎么做呢?

最佳答案

像这样,例如:

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP_HOST} !=www.example.co.uk
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule .* http://www.example.co.uk%{REQUEST_URI} [R=301,L]

关于.htaccess - 问题 301 redirect not allowing login in the backend,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7350910/

相关文章:

javascript - Apache 将 JavaScript 脚本解释为 text/html

apache - 不存在的路径名的htaccess错误页面

html - 经典 View /移动 View 切换?

magento - 使用内置的 magento url 重写会伤害 seo 吗?

php - htaccess 没有重定向到主 index.php

regex - htaccess : redirect old domain and all pages to a new domain

.htaccess - 防止 htaccess 表单重定向到 url 中的目录

html - 为什么要打开重定向 URLS?

php - 使用 PHP 的横幅统计和 Google Analytics

redirect - 站点性能 : rel=canonical vs redirect 301