Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite remove question mark "?" in url

New to Apache Rewrite

         

rMyersTL

6:55 pm on Jan 29, 2009 (gmt 0)

10+ Year Member



Hey I'm new to this an would really appreciate your help:

From what I've found so far I would have to create a rewrite rule that will enable us to remove the question mark to a page ( While also making sure that the page doesn't exist like index.php) example:

I searched all around the web and found various answers none in which solved our problem.

Problem 1:
www.example.com/pizza

instead of www.example.com/?q=pizza

problem 2:

www.example.com/users/First_LastName

instead of:
www.example.com/users/?personID=91/First_LastName

Richard

jdMorgan

7:08 pm on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



These are fairly simple problems -- See this thread [webmasterworld.com] in our Apache Forum library.

However, redirection to correct potential duplicate-content problems arising from the rewrite needed for your Problem #2 cannot easily be done using rewriterules, because mod_rewrite does not have access to the information needed to map "FirstNameLastName" to personID=91. So this aspect of the problem will have to be handled in your script. (This will make more sense after reading and understanding the cited thread; Pay particular attention to the last of the three steps needed to fully-implement static/SEO-friendly URLs.)

Jim

g1smd

7:13 pm on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Easy stuff, and similar question is asked every day.

Change the links on your page to use the new URLs. Links on the page 'define' the URL.

Set up a rewrite so that requests for the new URL are fulfilled by the content being delivered from the old internal script path.

Optionally set up a redirect from the old URLs to the new URLs, so that requests for the old URLs cannot be indexed as duplicates and external agents (e.g. bots) are forced to update their data to include the new URL and drop the old one.

Check the forum library for example code to get you started, and/or several threads in recent days.