Welcome to WebmasterWorld Guest from 54.159.179.132

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

URL redirecting messed up (WordPress & Opencart)

Presumably an .htaccess issue but can't figure out what

   
1:56 pm on Mar 2, 2013 (gmt 0)



I need your help with something that has me flummoxed.

I have WordPress installed in domain root (www.rxample.com) and OpenCart in a subfolder (www.example.com/shop/).

Both installations are multilingual (WP is multilingual via WPML).

Deployed OpenCart SEO URLs in core program, and Multilingual SEO URL Bundle plugin for OpenCart.

The multilingual plugin for Opencart creates beautiful URLs like www.example.com/shop/hu/ingyen-e-book which mostly work very well.

However, the OpenCart root for Hungarian language (our primary language) does not. www.example.com/shop/hu/ redirects me to www.example.com/rolunk/husegprogram/ which is a WordPress page.

I should note at this point that:
  • English shop root works fine www.example.com/shop/en/
  • If I change the slug of husegprogram to something that doesn't start with hu, then I get a 404.
  • RewriteBase is correct in the OC .htaccess and there is no mention of hu in WP .htaccess


I'm totally at a loss here, and would greatly appreciate some help.

Using
  • WordPress 3.5.1
  • OpenCart 1.5.4.1 with vQmod 2.3.0

(just to clarify, there is no integration between WordPress and OpenCart)

[edited by: incrediBILL at 8:51 pm (utc) on Mar 2, 2013]
[edit reason] Use Example.com per Forum Charter [/edit]

7:44 pm on Mar 2, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, oc2ps!

do you have any mod_rewrite directives in your .htaccess file that are relevant to this problem?
if you post what you find, please use example.com for your domain.
8:37 am on Mar 3, 2013 (gmt 0)



Thanks phranque

For WordPress it is
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress


For OpenCart it is
RewriteEngine On
RewriteBase /shop
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]
9:28 am on Mar 3, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



^(.*)\?*$ is supposed to match what example URLs?
The \?* should be completely redundant as RewriteRule RegEx cannot match query strings, only paths.

You have . in one ruleset and this matches requests for any folder or file except root example.com/

You have .* in the other and this matches requests for any folder or file including root.

I assume you should add an exclusion to the Wordpress code to shop it trying to grab requests for OpenCart URLs.

Detete the ifModule start and end tags. You don't need them.
10:46 am on Mar 3, 2013 (gmt 0)



I assume you should add an exclusion to the Wordpress code to shop it trying to grab requests for OpenCart URLs.

Thanks! Please can you guide me? I'm pretty much a newbie.
10:51 am on Mar 3, 2013 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



Delete the ifModule start and end tags. You don't need them.

And once you've done that, you can also delete the second
RewriteEngine On
line ... Unless you're quoting two different htaccess files in two different directories, both using mod_rewrite. If so, you are in deep ###. We just finished hashing out something similar a few days ago. (Short version: Don't even try. It isn't worth the aggravation.)

RewriteBase /shop


Doesn't a RewriteBase need a trailing slash? Probably a hypothetical question since I seriously doubt you can change RewriteBases in midstream. Luckily you don't need one; it's safer to write it out explicitly, starting with / for domain root each time.

The single most important thing to remember about htaccess is this: An incoming request doesn't teleport straight to the directory it lives in. Everything has to pass through all the layers of config file and root-level htaccess and inner-directory htaccesses. So you don't really have a "WordPress htaccess" and an "OpenCart htaccess". What you have is one htaccess that is used by everyone, and then a second htaccess that is only used by some things.
11:24 am on Mar 3, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



What you have is one htaccess that is used by everyone, and then a second htaccess that is only used by some things.

That's the most important point here.
11:29 am on Mar 3, 2013 (gmt 0)



Unless you're quoting two different htaccess files in two different directories, both using mod_rewrite.

That seems to indeed be the case.

The root folder has the WordPress .htaccess

The /shop folder which is home to OpenCart has the OpenCart .htaccess
1:40 pm on Mar 3, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The Wordpress htaccess needs to exclude OpenCart URLs.
2:16 pm on Mar 3, 2013 (gmt 0)



The Wordpress htaccess needs to exclude OpenCart URLs.

How? How do I put in the exclusions?
5:49 pm on Mar 3, 2013 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



use a RewriteCond directive.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month