| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|help needed for rewrite|
I get /foo?q=widget instead of /widget
| 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.
| 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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved