简体   繁体   English

htaccess从子域(根)重写为www(根),而不进行301重定向

[英]htaccess rewrite from subdomain (root) to www (root) without 301 redirect

I am having error in rewriting url. 我在重写网址时出错。 I want the request http://go.example.com/all-pathnames-flenames 我想要请求http://go.example.com/all-pathnames-flenames

should be handled by some page http://www.example.com/myfile.php 应该由某些页面http://www.example.com/myfile.php处理

It should not be hard or 301 redirect (rather original url should be there). 它不应该是硬的,也不应该是301重定向(而是应该有原始的url)。

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^go\.example\.com$ [NC]
RewriteRule ^(.*)$ /myfile.php [L]

above mentioned is the code i have but it is not working 上面提到的是我有的代码,但它不起作用

You need to exclude rewriting myfile.php , otherwise you'll create a loop: 您需要排除重写myfile.php ,否则将创建一个循环:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^go\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/myfile.php
RewriteRule ^(.*)$ /myfile.php [L]

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

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