简体   繁体   English

.htaccess 重定向不变 url 相同主机

[英].htaccess redirect without change url same host

I want to redirect a subdomain inside panel, the subdomain editor.domain.com我想重定向面板内的子域,子域editor.domain.com

It should redirect to domain.com/cmseditor .它应该重定向到domain.com/cmseditor

However the visitor should see editor.domain.com .但是访问者应该看到editor.domain.com

So far I've tried:到目前为止,我已经尝试过:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^editor\.homecatering\.pt$ [NC]
RewriteRule ^ http://homecatering.pt/cmseditor%{REQUEST_URI} [L,R=301]

Try something like this:尝试这样的事情:

RewriteEngine On

 # If the subdomain is "editor.homecatering.pt"
 RewriteCond %{HTTP_HOST} ^editor.homecatering.pt$ [NC]
 # Then rewrite any request to directory /cmseditor
 RewriteRule ^((?!cmseditor).*)$ /cmseditor/$1 [NC,L]

or或者

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.homecatering\.pt$ [NC]
RewriteRule ^(.*)$ http://homecatering\.pt/cmseditor/%1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM