Apache只重写域名,不重写主机名
我有以下资料:Apache只重写域名,不重写主机名,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我有以下资料: http://test.inside/index.html?something=big http://otherthing.inside/index.html?something=else “test”和“otherthing”可以是任何东西。我想捕获在http://和第一个句点之间键入的内容 RewriteRule ^/(.*)$ http://??.correct-domain.com/$1 [R,L] 我想把这些重定向到 http://test.correct-doma
http://test.inside/index.html?something=big
http://otherthing.inside/index.html?something=else
“test”和“otherthing”可以是任何东西。我想捕获在http://和第一个句点之间键入的内容
RewriteRule ^/(.*)$ http://??.correct-domain.com/$1 [R,L]
我想把这些重定向到
http://test.correct-domain.com/index.html?something=big
http://otherthing.correct-domain.com/index.html?something=else
这可能吗?我需要在VirtualHost语句中使用RewriteRule执行此操作
类似这样的东西,但我还需要捕获http://和第一个句点之间的第一部分
RewriteRule ^/(.*)$ http://??.correct-domain.com/$1 [R,L]
是的,很有可能。您可以在
文档\u ROOT/.htaccess
文件中使用此代码:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.inside\. [NC]
RewriteRule ^ http://%1.correct-domain.com%{REQUEST_URI} [NE,R=301,L]
%1
是在RewriteCond
@Jocker中捕获的HOST\u NAME
中第一部分的反向引用:这只是链接到当前问题。