Forums / Templates, Stylesheets, Page Layout / Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Locked

Started by nimbuz on 16 Jan 2008, 10:26 AM · Views: 3,613

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
16 Jan 2008, 10:26 AM
#1
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Hi,

I recently uploaded a locally installed (and modified) zencart version to my server. Installation went fine (I've done it several times earlier) and the homepage displays fine too, but product and category pages display a 404.

Is it something wrong with htaccess? Here's the code in it:

##### NOTE: Replace /shop/ with the relative web path of your catalog in the "Rewrite Base" line below:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /gr4in/

# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-m-([0-9]+).html$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+).html$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+).html$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+).html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]

# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html$ index\.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]

# For dreamscape's News & Articles Manager
RewriteRule ^news/?$ index\.php?main_page=news&%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml$ index\.php?main_page=news_rss&%{QUERY_STRING} [L]
RewriteRule ^news/archive/?$ index\.php?main_page=news_archive&%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index\.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index\.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index\.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html$ index\.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]

# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC] 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]

What could it be?

TIA.

CSS Evangelist

16 Jan 2008, 10:33 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Could we have a link to the site?

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

16 Jan 2008, 10:41 AM
#3
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Sure.

Homepage: http://tinyurl.com/2rbkta works. All innerpages lead to a 404 (redirecting to the default - blog - page).

Thanks

CSS Evangelist

16 Jan 2008, 11:11 AM
#4
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

I think you've started with the right idea (.htaccess) but taken a wrong turn. The .htaccess file that you have posted is not having any effect on your URLs as SEO URLs aren't being generated by your site (presumably you have turned this off) so there is nothing for that file to work with.

Nor do I think you are getting 404 errors.

Instead I believe that you have another .htaccess file operaing in the root of site that directs everything to the blog, unless told otherwise. I think that you have added a condition to allow access through to your Zen Cart, but that condition is too tight and is only sending some of your pages to the Zen Cart (e.g. the login page) while the rest are sent, by default, to the blog.

P.S. You might want to put some security on the "work" folder.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

16 Jan 2008, 11:20 AM
#5
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

I believe that you have another .htaccess file operaing in the root of site that directs everything to the blog

Hmm..I think so too. I'll dig it now and let you know. Thanks for the heads up. :-)

You might want to put some security on the "work" folder.

Done! ;-)

CSS Evangelist

16 Jan 2008, 11:25 AM
#6
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Hmmm...no. Its indeed a 404. I removed the htaccess from the root folder and zencart now displaya a 404 message.

CSS Evangelist

16 Jan 2008, 11:31 AM
#7
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Yep. And I can see the SEO URLs now. They're the only ones that are failing. Might this be that your base needs to be extended to reflect the location of the your site in the filesystem hierarchy?

Options +FollowSymLinks
RewriteEngine On
RewriteBase /gr4in/

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

16 Jan 2008, 11:33 AM
#8
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

I've replace a with 4 to prevent search bots from indexing it. Location is correct in the original htaccess.

CSS Evangelist

16 Jan 2008, 11:36 AM
#9
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Understood. I was wondering though whether it should be /work/gr4in/

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

16 Jan 2008, 12:05 PM
#10
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

np. :-)

I'm wondering what else could it be? There's another zencart installation in the same folder that works fine.

CSS Evangelist

16 Jan 2008, 12:16 PM
#11
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

what web and filesystem paths do you have in your includes/configure.php file?

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

18 Jan 2008, 5:21 AM
#12
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

  define('DIR_WS_CATALOG', '/work/gr4in/');
  define('DIR_WS_HTTPS_CATALOG', '/work/gr4in/');

  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
  define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

  define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
  //the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
  define('DIR_FS_CATALOG', '/ihome/q3lixcom/public_html/work/gr4in/');

Seems to be correct since the installaltion was successful.

Note: 3=e in q3lix ; 4=a in gr4ain

CSS Evangelist

18 Jan 2008, 7:43 PM
#13
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Update: Fixed it. had to just include a parent folder in the path (/work/...)

Thanks anyway.

CSS Evangelist

18 Jan 2008, 7:48 PM
#14
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

That's great!

Which path did you have to fix and is it ... errr ... different to what I suggested in post #9?

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

20 Jan 2008, 6:17 AM
#15
nimbuz avatar

nimbuz

Zen Follower

Join Date:
Oct 2007
Posts:
291
Plugin Contributions:
0

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

Argh!! I completely missed that! I was still looking at "gr4ain" and not the /work you suggedted.

Well, ahem, thanks. ;-)

CSS Evangelist

20 Jan 2008, 1:07 PM
#16
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Homepage works, other pages give 404 - problem with SEO mod and rewrite rules

No worries. Wasn't trying to beat you up - just confirm that I had understood correctly. Thanks for the confirmation.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)