ttt
ttt

Reputation: 69

Regular expression in htaccess for 301 redirects

I don't know why it doesn't work but what I want:

Old links: http://krater.hu/krater.php******* new links: http://regi.krater.hu/krater.php*******

My code is (But i was trying with a lot of things and still not working):

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/krater\.php(.+)$ http://regi.krater.hu/krater.php$1 [R=301,L]
</IfModule>

Can someone help me out please? Thank you!

Upvotes: 1

Views: 105

Answers (1)

anubhava
anubhava

Reputation: 786101

You can use this rule on your old host:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(krater\.php(.*))$ http://regi.krater.hu/$1 [R=301,L]
</IfModule>
  • Remove leading slash in URL pattern in htaccess
  • Don't se .+ after .php

Upvotes: 1

Related Questions