Forum Moderators: phranque

Message Too Old, No Replies

Invalid Url not redirecting to 404

         

lopsided

3:59 pm on Nov 8, 2011 (gmt 0)

10+ Year Member



Not sure what this is called so more info. on where to begin searching (what this is called) would be great.
Problem:
Adding a "/" and any characters after a properly formatted url on my site does not redirect the user to an error 404 page, rather it displays the page with broken css.
This only occurs on my .php pages, which account for 99% of my site.

Example:
www.mysite.com/page.php (works fine)
www.mysite.com/pag.php (misspelled url redirects properly to 404, works fine)
www.mysite.com/page.php/iaddedthis (displays page with broken css but I would hope it resulted in a 404)

Do I need something add'l in my htaccess file to handle this ? Should I be calling this an invalid query?
GWT shows lots of errors and the site is 150 pages in size so individual rewrites is not an option, nor could it be with all the odd ball url's coming up.

g1smd

4:06 pm on Nov 8, 2011 (gmt 0)

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



Turn features such as
AcceptPathInfo
and
mod_speling
off.

If both URLs resolve with 200 OK status you have a Duplicate Content issue.

The problem with the CSS comes because you are using relative links to the CSS file(s). The links should begin with a slash and count from the root. Do this for internal navigation as well as links to images, stylesheets and javascript files.

You should never "redirect" to an error page. The error page text should be returned at the originally requested URL.

lopsided

5:07 pm on Nov 8, 2011 (gmt 0)

10+ Year Member



Thank you for your desire to help me. I apologize for not being able to correctly relay what I mean as this is over my head and I am not familiar with all of the lingo.
By redirect to error page I merely mean that I am naming my error page ...
ErrorDocument 404 /missing.html

I understand the relative link issue breaking the css but I am assuming your suggestion of using a mod_speling off will stop it from trying to match the page name with the closest as I do not want that for this situation.

I will research how to write that. Thank you.

lucy24

10:08 pm on Nov 8, 2011 (gmt 0)

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



Another obvious question while you're at it: Your pages end in php. Does anything anywhere in the code expect to find something after the php? Is it written in such a way that it might accept input other than a properly written query string (leading ? mark)? That could account for an awful lot.

The documentation on mod_speling [httpd.apache.org] says it only works with one spelling error, as in your second example. So you could turn it off

CheckSpelling Off


but it wouldn't-- or shouldn't-- affect the bigger problem. Incidentally, it's supposed to be off by default, so you may want to take a closer look and see what other default settings have been changed. Apache itself doesn't seem to think much of this module ;)

lopsided

10:42 pm on Nov 8, 2011 (gmt 0)

10+ Year Member



Thank you lucy24. I tried adding CheckSpelling Off to my htaccess and it had no effect.

I am at a loss. I use php in conjunction with Popshops, which parses an affiliate database for products and it appears to work correctly, i.e. it displays the products, links properly, allows for search. However, when pages offer a search box function the pages will end with ? and then psps_search=searchwordused.
I have zero idea what to do about this or what is really going wrong so I'm afraid I don't know where to start.