| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|help needed for rewrite|
I get /foo?q=widget instead of /widget
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.
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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved