homepage Welcome to WebmasterWorld Guest from 23.22.179.210
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
strange redirect
spok




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

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




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

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




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

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

g1smd




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

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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved