0

How to create pernament redirect (301) for single page in .htaccess without mod_alias ?

f.e.

http://www.example.com/oldpage --> http://www.elpmaxe.com/newpage

marverix
  • 7,184
  • 6
  • 38
  • 50

2 Answers2

1

My teammate has given my good answer:

RewriteCond %{http_host} www\.example\.com$ [nc]
RewriteCond %{request_uri} ^/oldpage(/)?$ [nc]
RewriteRule ^(.*)$ http://www.elpmaxe.com/newpage [r=301,L,NC,NS,QSA]
marverix
  • 7,184
  • 6
  • 38
  • 50
-1

Use mod_rewrite and the following .htaccess

RewriteEngine on
RewriteRule ^oldpage/(.*)$ newpage/$1 [R=301]
mariusnn
  • 1,847
  • 18
  • 30