Forum Moderators: phranque

Message Too Old, No Replies

modrewrite not working

         

solfan

3:00 pm on Jun 25, 2008 (gmt 0)

10+ Year Member



This is my .htaccess file code:

# mod_rewrite in use
Options +FollowSymlinks
Order deny,allow
RewriteEngine On
#RewriteRule ^driversearch/(.*)$ /search.php?device=$1 [L]
RewriteRule driversearch/(.*) /search.php?device=$1 [L]

The problem I'm having is... my relative links stop working.. it believes the /driversearch directory exists.

Any ideas on how to clear this up so that it knows that /driversearch directory doesn't exit?

Is this a problem with my php code or perhaps something with 1and1.com hosting?

Thanks in advance for the help.

-James Oliver

jdMorgan

4:07 pm on Jun 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Short answer: You cannot use page-relative links on your pages, because the browser resolves those links based on the "page directory" it thinks it is looking at (the path in the browser address bar). Use server-relative (leading slash) or canonical links.

See this recent thread [webmasterworld.com] for a more thorough description -- I only want to type it once today. :)

An alternative is to add another rule that "corrects" the requests for included objects. While this does work, it also creates massive duplicate-content, since each object then becomes available at many URLs.

Jim

g1smd

11:17 pm on Jun 25, 2008 (gmt 0)

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



There seems to be a rogue Order deny,allow in that block of code.

solfan

6:32 am on Jun 26, 2008 (gmt 0)

10+ Year Member



Thanks!

I'm gonna have to figure out more about using those links :)

I'm still learning every day.

As for the rogue line, it's probably unnecessary, I just went through about 30 sites and tried 100 things to make it work.

Now, I'm having to read about $_SERVER[' '] code in php :)

Thanks for the input guys. Greatly appreciated.

-James Oliver