David
David

Reputation: 409

Universal Redirect Script

Is there a way to set up a redirect script that reads the file name and automatically redirects the browser to another file name with a different extension. Eg the user will go to shop.aspx the file name will automaticly get read by the script and redirect the user to shop.php. I would do this manually but there are lots of files that need to be edited.

Upvotes: 1

Views: 128

Answers (1)

joeldixon66
joeldixon66

Reputation: 950

You'll need to look at your .htaccess file. Here's a great guide that actually goes through what you are suggesting. If you want the .aspx files to be handled by php you could add a handler:

AddHandler application/x-httpd-php .aspx

Or if you just want to re-direct from one to the other you could use ModRewrite:

RewriteEngine  On
RewriteRule    ^(.*)\.aspx$ /$1.php [R=301,NC]

Upvotes: 2

Related Questions