Reputation: 75
I have in my .htaccess file line like this, which is work:
Redirect 301 /redirect/test.php http://example_site/newtest/1-newtest
but I am wondering about that can I use this to redirect from URL to another URL like this:
Redirect 301 https://example_site.pl/test/test/1,test http://example_site.pl/newtest/1-newtest
or it can be redirected only from path to URL?
Upvotes: 1
Views: 39
Reputation: 41219
You can use mod-rewrite
to redirect requests based on HTTP_HOST
header . To redirect /file.html
from a.com
to b.com
you can use something like the following:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?a\.com$
RewriteRule ^file\.html$ http://b.com/ [L,R]
References:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
Upvotes: 1