Help w/ mod rewrite rule - asp to php

Hi folks

recently converted a site from asp to php.  I'm keeping the same URL structure, which is like this:


I'd like a rewrite url that will simply take index.asp?id=page and send it to index.php?id=page.  "page" is just an example...whatever is after ".asp" should be put after ".php"

LVL 18
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

try this in your .htaccess

RewriteEngine On
RewriteRule ^index.asp$ index.php
> whatever is after ".asp" should be put after ".php"

Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*)\.asp$ $1.php [L,R=301]

#strip the R=301 is You don't want the user's browser bar be changed to *.php (so user will not know that You migrated to .php)
brunoAuthor Commented:
thanks both, I will try these later today.
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

brunoAuthor Commented:
they both seem to be close, but neither one is working....

if my domain is, this is what they are doing.

will redirect to:

which is technically the full path on the server...but i can't have that redirect happening for the user....

they both seem to be doing the same thing.

brunoAuthor Commented:
Ok, I found if i do this it works ok:

RewriteRule (.*)\.asp$ /$1.php [L,R=301]

but i assume that would only work in the root directory?
For some reason You have changed RewriteBase

RewriteBase /
just after RewriteEngine On

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brunoAuthor Commented:
Just a note, I haven't changed anything. This is a brand new hosting that must be the way it was set up.

That seems to work though, thank you.
> For some reason You have changed RewriteBase
It's my bad english. The default configuration sets RewriteBase to folder where .htaccess lives. It's changed on Your system.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.