.htaccess 外部域的Htaccess 301重定向问题
基本上,我使用一个注册器301将一个域重定向到另一个域[example.org],然后我还尝试使用[example.org]上的htaccess重定向一些内部页面 问题1:我正在尝试重定向 es/notice.php?file=news.php 到 es/ 但是,即使重定向工作正常,现在它看起来是 es/?file=news.php 问题2:单个页面的重定向e.x;php to/es/仍然不起作用,显示404.htaccess 外部域的Htaccess 301重定向问题,.htaccess,redirect,.htaccess,Redirect,基本上,我使用一个注册器301将一个域重定向到另一个域[example.org],然后我还尝试使用[example.org]上的htaccess重定向一些内部页面 问题1:我正在尝试重定向 es/notice.php?file=news.php 到 es/ 但是,即使重定向工作正常,现在它看起来是 es/?file=news.php 问题2:单个页面的重定向e.x;php to/es/仍然不起作用,显示404 # Use PHP5.4 as default AddHandler applicat
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
RewriteEngine On
Options -MultiViews
RewriteEngine On
RewriteBase /
Options +FollowSymLinks
RewriteRule ^/?pricing$ http://example.org/buy-stuff [R=301,L]
RewriteRule ^/?stuff-tour$ http://example.org/stuff-stuff-tour [R=301,L]
RewriteRule ^/?fr/stuff-tour$ http://example.org/stuff-stuff-tour [R=301,L]
RewriteRule ^/?es/notice.php$ http://example.org/es/ [R=301,L]
RewriteRule ^/?len.php$ http://example.org/es/ [R=301,L]
RewriteRule ^/?latest-blog-posts$ http://example.org/blog [R=301,L]
RewriteRule ^/?por/(.*)$ http://example.org/es/ [R=301,L]
RewriteRule ^/?nl/(.*)$ http://example.org/ [R=301,L]
RewriteRule ^/?it/(.*)$ http://example.org/ [R=301,L]
#ErrorDocument 404 /
RewriteCond %{THE_REQUEST} \.htm
RewriteRule ^(.*)\.htm$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.example.org$ [NC]
#RewriteRule ^(.*)$ http://example.org$1 [R=301,L]
#RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ $1/$2.htm [NC,L]
#RewriteRule ^([A-Za-z]+)$ $1.htm [NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.htm -f
RewriteRule ^([A-Za-z\-]+)$ $1.htm
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^\.localhost$ [NC]
RewriteRule ^(.+[^/])/$ http://%{HTTP_HOST}/$1 [R=301,L]
<FILES .htaccess>
order allow,deny
deny from all
</FILES>
Options -Indexes
IndexIgnore *.zip *.txt
es/?select=es&file=news.php不能仅使用上述规则从es/notice.php生成。还有其他规则或其他东西也在重定向您的请求。@SteveE。很抱歉,这是帖子中的一个错误,我现在更正了,请再次查看帖子您使用的是哪个版本的apache?2.4.x有一个选项[QSD],可以轻松解决问题1。@SteveE。好的,我修正了,thanks@SteveE. 关于第二个问题,出于某种奇怪的原因,我意识到唯一不重定向的页面是es/notice.php。该页面与另一个运行len.php的页面之间的唯一区别是,这个页面有一个subdir es/file.php