Welcome to WebmasterWorld Guest from 107.20.34.173

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

strange redirect

     

spok

11:29 am on Jan 21, 2012 (gmt 0)

5+ Year Member



Hi everyone, please help me with this bug:
urls www.example.com/fr/home, www.example.com/sk/home,www.example.com/hu/home
are being displayed correctly, where urls: www.example.com/en/home, www.example.com/pl/home, www.example.com/ru/home, www.example.com/cs/home are redirected to www.example.com/ru/ru/home (means 2times language code+'/')

the htaccess file:
RewriteRule ^(en|sk|cs|pl|hu|ru|fr)\/(application)\/(.+)$ ?page=2&$2=$3 [NC,L]
RewriteRule ^(application)\/(.+)$ ?page=2&$1=$2 [NC,L]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)\/(product)\/(.+)$ ?page=3&$2=$3 [NC,L]
RewriteRule ^(product)\/(.+)$ ?page=3&$1=$2 [NC,L]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)\/(service)\/(.+)$ ?page=4&$2=$3 [NC,L]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)\/(news)\/(.+)$ ?page=6&news=$3 [NC,L,NE]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)+\/(download)\/(.+)$ ?page=9&down=$3 [NC,L]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)\/(home)$ ?lang=$1 [NC,L]

RewriteRule ^(en|sk|cs|pl|hu|ru|fr)+\/(contact)\/(.+)$ ?page=5&contact=$3 [NC,L]


there is nothing else in the htaccess. and there is no other redirecting of the home page in further code.
thanks
spok

lucy24

11:59 am on Jan 21, 2012 (gmt 0)

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



Before you do anything else, get rid of all those \/ Directory slashes do not need to be escaped in mod_rewrite.

Your first two pairs of rules make me uneasy because it looks as if they are intended to go together, but there's nothing really binding them.

Best 4 AM guess: some of your directory names contain within themselves the letter sequences "en" or "pl" or "ru", leading to havoc in the rewrites.

And, er, what's with the plusses in
(en|sk|cs|pl|hu|ru|fr)+
? Now you're raising the possibility of directories named ... uhm, well, it's too late in the night to play Scrabble but I'd be uneasy about the possibilities.

Oh, and if anything is really being redirected, there must be something else in another htaccess or the config file. All of your rules are Rewrites.

Where does
www.example.com/ru/ru/home
come from? All your Rewrites are only concerned with the query string.

spok

1:48 pm on Jan 21, 2012 (gmt 0)

5+ Year Member



thanks lucy, I have found the mistake in the redirection outside htaccess, which I have refused before. consultation helped, good night :)

g1smd

10:17 pm on Jan 21, 2012 (gmt 0)

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



I would prefix your rewrite target query string in each rule with /index.php to be sure the rewrite operates correctly.

(en|sk|cs|pl|hu|ru|fr)+ would allow a request beginning /frenpl/ or /ruru/ to be valid. Is that what you want?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month