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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
intellivision
Forum Commoner
Posts: 83
Joined: Mon Aug 22, 2005 1:25 am
Location: Orbit

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

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the AddType directive can be used to alter/add-to the extensions php will process.
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

Code: Select all

AddType application/x-httpd-php .php .asp
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

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

Post 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.
intellivision
Forum Commoner
Posts: 83
Joined: Mon Aug 22, 2005 1:25 am
Location: Orbit

Post 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.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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]
Post Reply