Page 1 of 1
How to get this rewrite rule working?
Posted: Tue Jan 28, 2014 6:03 pm
by lovelf
rewrite rule:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^search/(.*)$
http://www.domain.com/search/?term=$1
I want all search/my_search to go to search/?term=my_search silently
Thanks
Re: How to get this rewrite rule working?
Posted: Tue Jan 28, 2014 7:17 pm
by requinix
And the problem is... that it's not silent? But otherwise works?
Re: How to get this rewrite rule working?
Posted: Tue Jan 28, 2014 7:23 pm
by Celauran
By matching everything after search/ and redirecting it to a URL containing search/, you have created an infinite loop. I'd have thought matching everything except a question mark (ie. ([^\?]+)) would work, but that still redirects forever. This isn't perfect, but it works.
Code: Select all
RewriteRule ^search/([a-zA-Z0-9\-_\+\s]+)$ search/?term=$1 [L]
Re: How to get this rewrite rule working?
Posted: Tue Aug 12, 2014 4:24 am
by KarlRice
Hay friend
Try it for getting the rewrite rule working
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cp.abc.com$ [OR]
RewriteCond %{HTTP_HOST} ^
www.cp.abc.com$
RewriteRule ^/?$ "http\:\/\/cp\.xyz\.com" [R=301,L]
I have also ensured IP and document root path on both subdomains under /var/cpanel/userdata/username/ directory and it is correct.
Thank you