【问题标题】:.htaccess redirect without change url same host.htaccess 重定向而不更改 url 相同的主机
【发布时间】:2020-09-21 09:40:54
【问题描述】:

我想重定向面板内的子域,子域editor.domain.com

它应该重定向到domain.com/cmseditor

但是访问者应该看到editor.domain.com

到目前为止我已经尝试过:

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

【问题讨论】:

  • 相同的主机设置?你能解释得更好吗?

标签: apache .htaccess server cpanel


【解决方案1】:

试试这样的:

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]

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

【讨论】:

    猜你喜欢
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-25
    • 1970-01-01
    • 2013-06-11
    • 1970-01-01
    相关资源
    最近更新 更多