Page 1 of 1

Can my Apache server process php code in .asp files?

Posted: Sat Jun 03, 2006 12:38 pm
by intellivision
How can I tell the web server to process .asp files as though they were .php files?

I know: any vbscript in them won't be executed.

It's for SEO reasons that I want to keep the .asp extensions.

Posted: Sun Jun 04, 2006 9:24 am
by feyd
the AddType directive can be used to alter/add-to the extensions php will process.

Posted: Sun Jun 04, 2006 9:51 am
by ok

Code: Select all

AddType application/x-httpd-php .php .asp

Re: Can my Apache server process php code in .asp files?

Posted: Sun Jun 04, 2006 12:47 pm
by timvw
intellivision wrote:How can I tell the web server to process .asp files as though they were .php files?

I know: any vbscript in them won't be executed.

It's for SEO reasons that I want to keep the .asp extensions.
I would let your webserver reply with a 301 Moved Permanently for the asp pages and provide the new location.

Posted: Sun Jun 04, 2006 3:00 pm
by intellivision
I should have added it's a virtual server. I suppose I should ask tech support if I can modify the Apache config file (assuming feyd and ok, your solution was meant to be added to that file).

timvw, can your solution be implemented through .htacess?

In that file I have a
but of course it's throwing a 302.

Thanks, you three.

Posted: Tue Jun 06, 2006 2:47 am
by timvw
You mean something along the lines of the following?
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.asp$ http://example.com/$1.php[R=301,L]