flaesk Posted September 10, 2013 Share Posted September 10, 2013 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: http://mydomain.com/Om%20Kuren.aspx http://mydomain.com/manden/Til%20mand.aspx http://mydomain.com/kvinden/Til%20Kvinder.aspx http://mydomain.com/Vilkaar%20og%20miljo.aspx http://mydomain.com/Inden%20i%20går%20igang.aspx The new URLs is: http://mydomain.com/om-kuren.php http://mydomain.com/til-manden.php http://mydomain.com/til-kvinder.php http://mydomain.com/vilkaar-og-miljo.php http://mydomain.com/inden-i-gaar-igang.php 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. Quote Link to comment https://forums.phpfreaks.com/topic/282045-301-redirect-from-aspx-to-php-via-htaccess/ Share on other sites More sharing options...
requinix Posted September 10, 2013 Share Posted September 10, 2013 Redirect is better, and decode the URLs first. Redirect permanent /Om\ Kuren.aspx http://mydomain.com/om-kuren.phpIf 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 Quote Link to comment https://forums.phpfreaks.com/topic/282045-301-redirect-from-aspx-to-php-via-htaccess/#findComment-1449009 Share on other sites More sharing options...
flaesk Posted September 10, 2013 Author Share Posted September 10, 2013 Hi requinix Thank you SO much. The escaped spaces worked out so fine. All the best to you! Thank you once again! Quote Link to comment https://forums.phpfreaks.com/topic/282045-301-redirect-from-aspx-to-php-via-htaccess/#findComment-1449017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.