Zen Cart Logo

no 404 page

Locked

Views: 1,233

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
2 Aug 2009, 8:22 PM
#1
jgdovin avatar

jgdovin

New Zenner

Join Date:
May 2009
Posts:
36
Plugin Contributions:
0

no 404 page

Ok if I type in my address http://police-equipment-worldwide.com/fubar it takes me to the home page instead of a 404 error page, but if I type in http://police-equipment-worldwide.com/index.php?main_page=fubar it will go to the 404 page correctly. This is really hurting me on search rankings. Im sure it has something to do with my htaccess but I just cant figure it out, any suggestions?

Here is my .htaccess...

#### BOF SSU
Options +FollowSymLinks -MultiViews
RewriteEngine on
# Make sure to change "zencart" to the subfolder you install ZC. If you use root folder, change to: RewriteBase /
RewriteBase /
Options -Indexes



# Start the Apache RewriteEngine.

RewriteEngine on



RewriteCond %{HTTP_USER_AGENT} ^Morfeus

RewriteRule ^.*$ - [F]



# Add www.

RewriteCond %{HTTP_HOST} ^police-equipment-worldwide.com [NC]

RewriteRule .? http://www.police-equipment-worldwide.com%{REQUEST_URI} [R=301,L]



# CycleCop.com

RewriteCond %{HTTP_HOST} ^cyclecop\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.cyclecop\.com [NC]

RewriteRule ^CycleCop(.*) - [L]

RewriteCond %{HTTP_HOST} ^cyclecop\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.cyclecop\.com [NC]

RewriteRule ^(.*) CycleCop/$1 [L]



# TeksPolice.com

RewriteCond %{HTTP_HOST} ^tekspolice\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.tekspolice\.com [NC]

RewriteRule ^TeksPolice - [L]

RewriteCond %{HTTP_HOST} ^tekspolice\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.tekspolice\.com [NC]

RewriteRule ^(.*) TeksPolice/$1 [L]



# Police-Motorcycle-Equipment.com

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.police-motorcycle-equipment\.com [NC]

RewriteRule ^Police-Motorcycle-Equipment - [L]

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.police-motorcycle-equipment\.com [NC]

RewriteRule ^(.*) Police-Motorcycle-Equipment/$1 [L]





# Police-Motorcycle-Equipment.com

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.police-motorcycle-equipment.com [NC]

RewriteRule !^(Police-Motorcycle-Equipment.com)$ Police-Motorcycle-Equipment.com/$1 [L]



# Remove charactors from url's

RewriteRule ^/?(.*)'(.*)$ $1$2 [R=301,N,L]











RewriteRule ^favicon.ico - [L]

RewriteRule ^robots.txt - [L]

#RewriteRule ^info.txt - [L]

RewriteRule ^misc/(.*) - [L]

RewriteRule ^CSS/(.*) - [L]

RewriteRule ^images/(.*) - [L]
RewriteRule ^zc_install/(.*) - [L]

RewriteRule ^Scripts/(.*) - [L]
RewriteRule ^extras/(.*) - [L]
RewriteRule ^PDF/(.*) - [L]

RewriteRule ^Public/(.*) - [L]

RewriteRule ^PV/(.*) - [L]

RewriteRule ^includes/(.*) - [L]
RewriteRule ^zen/(.*) - [L]

RewriteRule ^old/(.*) - [L]

RewriteRule ^info/(.*) - [L]

RewriteRule ^Store/(.*) - [L]

RewriteRule ^admin/(.*) - [L]

RewriteRule ^MODPDF/(.*)  PDF/View.php [L]

RewriteRule ^(.*) index.php [L]


# Deny access from .htaccess
RewriteRule ^\.htaccess$ - [F]
2 Aug 2009, 8:39 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: no 404 page

If you look in your /extras folder, you'll see an example of the .htaccess code you need to copy and add to your main .htaccess to handle 404 page redirects to where you want them to go.

4 Aug 2009, 10:04 PM
#3
jgdovin avatar

jgdovin

New Zenner

Join Date:
May 2009
Posts:
36
Plugin Contributions:
0

Re: no 404 page

DrByte: thanks for the reply but this is not working for my site, I changed it to look like

#### BOF SSU


ErrorDocument 404 http://www.police-equipment-worldwide.com/index.php?main_page=page_not_found
Options +FollowSymLinks -MultiViews
RewriteEngine on
# Make sure to change "zencart" to the subfolder you install ZC. If you use root folder, change to: RewriteBase /
RewriteBase /
Options -Indexes



# Start the Apache RewriteEngine.

RewriteEngine on



RewriteCond %{HTTP_USER_AGENT} ^Morfeus

RewriteRule ^.*$ - [F]



# Add www.

RewriteCond %{HTTP_HOST} ^police-equipment-worldwide.com [NC]

RewriteRule .? http://www.police-equipment-worldwide.com%{REQUEST_URI} [R=301,L]



# CycleCop.com

RewriteCond %{HTTP_HOST} ^cyclecop\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.cyclecop\.com [NC]

RewriteRule ^CycleCop(.*) - [L]

RewriteCond %{HTTP_HOST} ^cyclecop\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.cyclecop\.com [NC]

RewriteRule ^(.*) CycleCop/$1 [L]



# TeksPolice.com

RewriteCond %{HTTP_HOST} ^tekspolice\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.tekspolice\.com [NC]

RewriteRule ^TeksPolice - [L]

RewriteCond %{HTTP_HOST} ^tekspolice\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.tekspolice\.com [NC]

RewriteRule ^(.*) TeksPolice/$1 [L]



# Police-Motorcycle-Equipment.com

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.police-motorcycle-equipment\.com [NC]

RewriteRule ^Police-Motorcycle-Equipment - [L]

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment\.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www\.police-motorcycle-equipment\.com [NC]

RewriteRule ^(.*) Police-Motorcycle-Equipment/$1 [L]





# Police-Motorcycle-Equipment.com

RewriteCond %{HTTP_HOST} ^police-motorcycle-equipment.com [NC,OR]

RewriteCond %{HTTP_HOST} ^www.police-motorcycle-equipment.com [NC]

RewriteRule !^(Police-Motorcycle-Equipment.com)$ Police-Motorcycle-Equipment.com/$1 [L]



# Remove charactors from url's

RewriteRule ^/?(.*)'(.*)$ $1$2 [R=301,N,L]









RewriteRule ^favicon.ico - [L]

RewriteRule ^robots.txt - [L]

#RewriteRule ^info.txt - [L]

RewriteRule ^misc/(.*) - [L]

RewriteRule ^CSS/(.*) - [L]

RewriteRule ^images/(.*) - [L]
RewriteRule ^zc_install/(.*) - [L]

RewriteRule ^Scripts/(.*) - [L]
RewriteRule ^extras/(.*) - [L]
RewriteRule ^PDF/(.*) - [L]

RewriteRule ^Public/(.*) - [L]

RewriteRule ^PV/(.*) - [L]

RewriteRule ^includes/(.*) - [L]
RewriteRule ^zen/(.*) - [L]

RewriteRule ^old/(.*) - [L]

RewriteRule ^info/(.*) - [L]

RewriteRule ^Store/(.*) - [L]

RewriteRule ^admin/(.*) - [L]

RewriteRule ^MODPDF/(.*)  PDF/View.php [L]

RewriteRule ^(.*) index.php [L]


# Deny access from .htaccess
RewriteRule ^\.htaccess$ - [F]

I also tried putting the errordocument after rewrite rule turning on, neither worked. Any suggestions? Is there something in my .htaccess preventing this from working?

4 Aug 2009, 10:10 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: no 404 page

I'm completely ignoring all your RewriteRule lines, because they should have no impact on an ErrorDocument directive.

If the .htaccess file you quoted is in the top of your webroot (ie: .../public_html/.htaccess), then it should work just fine.
Apparently it doesn't ... so ... you'll need to talk to your hosting company about how they have configured the server with respect to ErrorDocument directives. Maybe they require that you set those up using your hosting account control panel? Or maybe they don't allow you to override them at all. Or maybe they have a master rule which is prevailing.
Whatever the case, you need someone familiar with your particular server's technical configuration to look at it.

4 Aug 2009, 10:38 PM
#5
jgdovin avatar

jgdovin

New Zenner

Join Date:
May 2009
Posts:
36
Plugin Contributions:
0

Re: no 404 page

ok I figured it out on my own, the htaccess was from a clients previous store and I am not quite sure why they had the line

RewriteRule ^(.*) index.php [L]

since by default the website goes to index.php when you type in the address and all links should point to the right spot, unless their php required it for some reason. So far removing that line has allowed the 404 error to work correctly, and I havent seen any problems yet. Still testing areas of the site, but I dont see any problems popping up. Thank you again

(took me a minute to remember all the stuff that works with rewrite engine, and this line of course forwards anything not specifically stated to be routed to route to the index.php, hence why 404's were showing the index page.)

4 Aug 2009, 10:59 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: no 404 page

Ah. See, that's why I stay away from RewriteRules. :blush: