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*******

Read More

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!

Related posts

Leave a Reply

1 comment

  1. 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