将所有页面重定向到新域,排除带有htacces的页面 [英] Redirect all pages to new domain exclude one page with htacces

查看:43
本文介绍了将所有页面重定向到新域,排除带有htacces的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将所有页面重定向到新域,但不包含带有htacces的页面.

I try redirect all pages to new domain exclude one page with htacces.

RewriteCond %{REQUEST_URI}!^/onepage.php/
RewriteRule (.*) http://newdomain.com/$1 [R=301,L]

这是可行的,但是page onepage.php显示内部错误500

This is working but page onepage.php show internal error 500

推荐答案

您可以在.htaccess文件中尝试以下任一操作:

You can try with either of the following in your .htaccess file:

示例1:检查onepage.php的请求URI并重定向(如果未请求):

Example 1: Check the request URI for onepage.php and redirect if it is not being requested:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/onepage.php [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

示例2::如果正在请求onepage.php,请不要执行任何操作.否则,请重定向:

Example 2: If onepage.php is being requested, don't do anything. Otherwise, redirect:

RewriteEngine on

RewriteRule ^onepage\.php - [L]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

在重定向除之外的所有内容时,文件中不需要任何其他规则.上面的规则应该是其中唯一的规则.

As you're redirecting everything except for onepage.php, you do not need any other rules in your file. The rules above should be the only ones in there.

这篇关于将所有页面重定向到新域,排除带有htacces的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆