Jump to content

301 redirect from .aspx to .php via .htaccess


flaesk

Recommended Posts

Hello everybody

 

This is my first post here. Hope you guys can help me out.

 

I have moved from a Microsoft server to a Linux server.

 

Now I want to redirect the URLs from .aspx to .php via the .htaccess file.

 

The old URLs is:

 






 

The new URLs is:

 






 

I have tried the following, that doesn't seems to work:

 



    RewriteEngine On
    RewriteRule ^Om%20Kuren\.aspx$ http://mydomain.com/om-kuren.php [R=301]
    RewriteRule ^manden/Til%20mand\.aspx$ http://mydomain.com/til-manden.php [R=301]
    RewriteRule ^kvinden/Til%20Kvinder\.aspx$ http://mydomain.com/til-kvinder.php [R=301]
    RewriteRule ^Vilkaar%20og%20miljo\.aspx$ http://mydomain.com/vilkaar-og-miljo.php [R=301]
    RewriteRule ^Inden%20i%20går%20igang\.aspx$ http://mydomain.com/inden-i-gaar-igang.php [R=301,L]


 

Thanks in advance.

Redirect is better, and decode the URLs first.

Redirect permanent /Om\ Kuren.aspx http://mydomain.com/om-kuren.php
If you have Apache 2.2.6 or later then you can omit the "http://mydomain.com".

 

Pretty sure the escaped space works. Otherwise

RedirectMatch permanent ^/Om.Kuren\.aspx$ http://mydomain.com/om-kuren.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.