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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.