Forum Moderators: phranque

Message Too Old, No Replies

Rewriting via htaccess problem on shared host

Works but messing up some nav.

         

Frequent

3:46 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



I am testing a php based script on a shared hosting account (Apache based). The script has a built in search engine friendly option (htaccess rewrite) that doesn't seem to be working quite right.

Links on the site appear correctly (search engine friendly) on mouse-over but after you click they take to user to the pre-rewritten url. By this I mean that the dynamic url appears in the address bar.

After running a validator on the links it appears the host is handling the rewrite by 301'ing the rewritten urls to the actual dynamic url. This doesn't seem normal and it doesn't appear to function this way on other installations I've seen.

One side effect of this seems to be that some java navigation elements are messed up causing the user to be routed back to the index page.

Any suggestions?

Freq

Frequent

7:33 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



If there is more information that I can provide (within TOS of course) please let me know. I posted here because the author of the script suggested it may be a problem with a server setting since I am running the same htaccess as every other installation out there and they all work correctly.

Freq---

jdMorgan

8:10 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> the dynamic url appears in the address bar

Not good... That pretty much defeats attempts to use search-engine-friendly URLs.

These "redirects" should be "rewrites" instead, functioning entirely internal to the server. In mod_rewrite, the two forms are:

Redirect:

 RewriteRule ^something$ http://www.example.com/other_thing [R=301,L] 

Rewrite:

 RewriteRule ^something$ /otherthing [L] 

Jim

Frequent

9:04 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



None of the htaccess rules call for a 301. Any suggestions as to what may be out of whack with the server settings that would cause it to treat everything as a 301?

Here is the message I get from the W3C Link Checker on all the rewritten links:

[example.com...] redirected to
[example.com...]
What to do: You should update the link.
Response status code: 301 -> 200
Response message: Moved Permanently -> OK
Lines: 51, 111

Freq---

jdMorgan

9:09 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest you contact the author of the script and/or your host on this one...

Servers don't just 'magically' decide to redirect on their own, so some code somewhere --either in your account or at the the server level-- has been installed and causes this redirect.

Jim

Frequent

9:15 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



I do plan to contact my host. I was just hoping that an "Apache Guru" would be able to help me tell them where to look. As I mentioned, this is a shared hosting account and response time is typically 24 hours per. I'd rather not burn a few days going back and forth with the host. (I know it's my own fault for going the cheap shared hosting route. You really do get what you pay for with regards to hosting.)

Freq---

jd01

9:34 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not my specialty, but rewrites happening at the server level happen in the httpd.conf file... this would be a good place to start looking. You might your host to tell you the actual settings of the file, then generalize and post any protions dealing with rewrites, etc.

If you can't find anything there, you might consider generalizing a couple of the rule/condition sets so we can see what is actually happening in your .htaccess file. Might help something 'click'

Justin