Help - Search - Members - Calendar
Full Version: Non-existing url leads to home page
HTMLHelp Forums > Programming > Web Server Configuration
stjepan
Hello,

I've been searching around but found nothing and my hosting also have no idea why a) when some random string is attached to the adress eg. poandpo.com/abdedfgh the response will be 404 but b) when there are uppercase characters, for example poandpo.com/AbCde than the home page is loaded. Does anyone has an idea how to solved that?
Christian J
I get redirected to http://www.poandpo.com/404/ with both http://www.poandpo.com/abc and http://www.poandpo.com/ABC

pandy
Did you fix this? I get the error page every time.

But there actually is no 404. There's a 302.

CODE
GET /arsdfgjkl/ HTTP/1.1
HTTP/1.1 302 Moved Temporarily


then the page is somehow redirected to /404/ that in turn does return a 404. wacko.gif

CODE

GET /404/ HTTP/1.1
HTTP/1.1 404 Not Found
pandy
Wait, I got the frontpage with this URL but not with the one you provided or the other ones I made up. biggrin.gif

http://www.poandpo.com/PANDY.HTML
pandy
Now I get the error page with the pandy-URL too. What the heck are you playing with on that server?
Christian J
QUOTE(Christian J @ Jul 27 2013, 02:53 PM) *

There is a difference. http://www.poandpo.com/abc returns a 302 directly to http://www.poandpo.com/404/ along with a cookie:

CODE
HTTP/1.1·302·Moved·Temporarily(CR)(LF)
Date:·Sat,·27·Jul·2013·18:12:52·GMT(CR)(LF)
Server:·Apache(CR)(LF)
X-Powered-By:·PHP/5.3.24(CR)(LF)
Expires:·Thu,·19·Nov·1981·08:52:00·GMT(CR)(LF)
Cache-Control:·no-store,·no-cache,·must-revalidate,·post-check=0,·pre-check=0(CR)(LF)
Pragma:·no-cache(CR)(LF)
Set-Cookie:·PHPSESSID=56450f00b3203bdc6c68f1158bc0d4d2;·path=/(CR)(LF)
Location:·http://www.poandpo.com/404/(CR)(LF)
Vary:·Accept-Encoding,User-Agent(CR)(LF)
Content-Length:·0(CR)(LF)
Connection:·close(CR)(LF)
Content-Type:·text/html(CR)(LF)
(CR)(LF)

while http://www.poandpo.com/ABC first returns this 301 to http://www.poandpo.com/abc:

CODE
HTTP/1.1·301·Moved·Permanently(CR)(LF)
Date:·Sat,·27·Jul·2013·18:13:26·GMT(CR)(LF)
Server:·Apache(CR)(LF)
Location:·http://www.poandpo.com/abc(CR)(LF)
Content-Length:·234(CR)(LF)
Connection:·close(CR)(LF)
Content-Type:·text/html;·charset=iso-8859-1(CR)(LF)
(CR)(LF)

and from there the 302 to http://www.poandpo.com/404/.

Could the cookies have anything to do with this?


pandy
wacko.gif wacko.gif wacko.gif

What is doing this? A .htacces file or PHP or something out of your control, that is the question. sleep.gif
pandy
I snooped up a couple of other domains on the same server, and they have normal 404s. So I'd say it's your own doing. tongue.gif

http://albumi.info/dfgsadgsfg
stjepan
Thank you all for all those tests :-) I made changes to .htaccess to convert mixed case to lowercase letters and now it's fine. I'll have to look at cookies again, there are two of them, one added a few weeks ago, to see did I missed something. Just to add that I read probably all articles published about similar problems on the Northern Hemisphere and found no answer, just thousands of non-working solutions from "gurus". Htmlhelp rulez, other "webmasters"... I'll stop here.

And I must go through code again to check did I miss some side-effect since I rewrote almost all CMS and after several thousand lines I feel sick :-)
pandy
But it must be something you've done. Look through your .htaccess.
stjepan
After solving my problem so brilliantly that I made the slowest website in the known universe, I returned to old .htaccess. So, the problem is still here but it's less damage than having a site slow as a turtle.

Here is my .htaccess file if someone has time and will to take a look, something is obviously missing:

CODE
RewriteEngine On
Redirect 301 http://poandpo.com http://www.poandpo.com
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]
Christian J
CODE
RewriteEngine On
Redirect 301 http://poandpo.com http://www.poandpo.com

The above doesn't seem to work. According to http://httpd.apache.org/docs/current/mod/m...s.html#redirect (do you use Apache 2.4?) the old URL path should begin with a slash.

Not sure about the rest of the .htaccess file.
stjepan
Thanks for this, I'm on 2.2.24.
pandy
I think this
CODE
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]


means that if the the file isn't a directory (!-d), redirect to index.php?category=...

Only problem is it doesn't seem to work that way. unsure.gif
stjepan
It is redirecting and rewriting php?style?category?names into more friendly URLs. I'm afraid I'll have to go into php code again, maybe I can make things simpler.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.