문제

I am having error in rewriting url. I want the request http://go.example.com/all-pathnames-flenames

should be handled by some page http://www.example.com/myfile.php

It should not be hard or 301 redirect (rather original url should be there).

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:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^go\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/myfile.php
RewriteRule ^(.*)$ /myfile.php [L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top