homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

help needed for rewrite
I get /foo?q=widget instead of /widget

5+ Year Member

Msg#: 3585320 posted 7:28 pm on Feb 26, 2008 (gmt 0)

I have a website where dynamic URLs are rewritten to more friendly ones like:
mysite.com/index.php?q=foo becomes mysite.com/foo.
The rewrite is as follows: RewriteRule ^(.*)$ /?q=$1 [L]

It works perfectly well, i.e., the mysite.com/foo retrieves the the database entry "foo" (a dictionary entry).

But the "foo" page contains some hyperlinks to other entries, say to "widget," and when the page is retrieved, the link to widget becomes:


Is there a way to eliminate this self referencing (foo?q=) and have only the widget (mysite.com/widget) when the widget link on the foo page is clicked?

Thank you in advance.



WebmasterWorld Senior Member 10+ Year Member

Msg#: 3585320 posted 2:42 pm on Feb 27, 2008 (gmt 0)

It should be possible by modifying your programming.

In your database, instead of having the links as <a href="/index.php?q=varId"> have them as <a href="/varId">.

The mod_rewrite does not rewrite url's coming from the database, it only interprets one URL and matches it with another - but you have to point it to the right match.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved