我偶然发现了一个独特的问题。
网站- http://example.com
Blog - http://example.net
现在博客(example.net)被移动到example.com/example_blog(由于未知的原因,它是使用域别名完成的)。
下面的。htaccess被添加到路由http://example.net/page到http://example.com/example_blog/page
RewriteEngine On
Options -Indexes
RewriteCond %{HTTP_HOST} ^www'.example'.net$ [OR]
RewriteCond %{HTTP_HOST} ^example'.net$
RewriteRule (.*) http://example.com/example_blog/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
现在问题来了因为example.net是example.com的别名我可以访问
http://example.net/folder_and_file_from_example.com我希望http://example.net/folder_and_file_from_example.com被重定向到http://example.com/example_blog/folder_and_file_from_example.com(这会显示404错误)
我希望我解释得足够清楚。它应该与下面需要在上述代码中完成的更改一起工作。
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-s [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d