Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

help needed for rewrite

I get /foo?q=widget instead of /widget

     
7:28 pm on Feb 26, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:July 22, 2005
posts:151
votes: 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:

mysite.com/foo?q=widget

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 14, 2003
posts:1550
votes: 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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members