Reputation: 5078
What I'm trying to do is redirecting requests on http://example.com/tel.php to http://example.com/default/index/tel without showing any redirection to the user. I'm doing this in htaccess:
RewriteEngine On
RewriteRule ^tel\.php$ /default/index/tel [NC,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
however the redirection shows to the user (HTTP/1.1 301 Moved Permanently) which I'm trying to avoid.
How to solve this ?
Upvotes: 1
Views: 43
Reputation: 785058
Change the order of your rules and optionally add a trailing slash if
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^tel\.php$ /default/index/tel [NC,L]
# make it as this if /default/index/tel/ is a real directory
# RewriteRule ^tel\.php$ /default/index/tel/ [NC,L]
Make sure to test it after clearing your browser cache.
Upvotes: 1