.htaccess htaccess-重写子域正在中断相对路径
我使用cPanel的设置:.htaccess htaccess-重写子域正在中断相对路径,.htaccess,path,virtual,relative-path,wildcard-subdomain,.htaccess,Path,Virtual,Relative Path,Wildcard Subdomain,我使用cPanel的设置: domain.com(/public\u html/) mysub.domain.com(/public_html/2013/sitepath/) 目标:使sub2.mysub.domain.com/save-path-info重定向到mysub.domain.com/save-path-info,而不更改sub2.mysub.domain.com的url。换句话说,我希望anysub.mysub.domain.com实际上与mysub.domain.com完全相同
Options+FollowSymLinks
选项+索引
重新启动发动机
RewriteCond%{HTTP\u HOST}^[^\.]+\.mysub\.domain\.com$[NC]
重写规则^(.*)$http://mysub.domain.com/$1[L]
#-首页-
IndexIgnore.htaccess*/.??**~*#*/HEADER**/README**/\u vti*
命令拒绝,允许
全盘否定
通融
命令拒绝,允许
全盘否定
AuthName domain.com
AuthUserFile/home/uadmin/public_html/_vti_pvt/service.pwd
AuthGroupFile/home/uadmin/public_html/_vti_pvt/service.grp
尝试以下代码:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^\.]+\.mysub\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://mysub.domain.com/$1 [L]
谢谢你的及时回复!这确实保存了所有内容,并且模板不会中断,但是,它不会在地址栏中维护URL。如果我的答案可以帮助您,您可以验证我的答案。你设置的地址是什么?我插入了我的url。当我测试subone.subdomain.domain.com/index.php时,它重定向到subdomain.domain.com/index.php。它保存了路径(index.php),但没有在url中保留子目录。我想在地址栏中保留subone.subdomain.domain.com,即使它实际上正在加载subdomain.domain.com,但它不是来自我的代码,因为我不添加重定向。。。您正在使用的代码是什么?整个HTACCESS(主要适用于其他域),请参阅后期编辑。
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^\.]+\.mysub\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://mysub.domain.com/$1 [L]
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName domain.com
AuthUserFile /home/uadmin/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/uadmin/public_html/_vti_pvt/service.grp
RewriteEngine On
RewriteCond %{HTTP_HOST} ^[^\.]+\.mysub\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://mysub.domain.com/$1 [L]