Change Url With A Query

New to mod_rewrite? This is a good place to start.

Change Url With A Query

Postby sharingsunshine » Mon Dec 21, 2009 2:42 pm

Hello,

I am trying to remove the /fr in the url listed below. The topic and msg number change.

# http://www.anydomain.com/fr/smf/index.p ... icseen#new
RewriteCond %{QUERY_STRING} ^(topic|board)=([0-9]+)\.msg(.+) [NC]
RewriteRule ^fr/smf/index\.php$ http://www.anydomain.com/smf/index.php$1=$2.msg$3 [R=301,L]

this isn't removing /fr so please tell me how to fix this.

Thanks,

Randal
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Postby sharingsunshine » Tue Dec 22, 2009 8:35 am

Getting Closer:

RewriteCond %{QUERY_STRING} ^(topic|board)=([0-9]+)\.msg(.+)$
RewriteRule ^fr/smf/index\.php?$ /smf/index.php?%1=%2.msg%3 [R=301,L]

However, I now am getting for the url:
http://www.anydomain.com/smf/index.php? ... btopicseen

it seems the ';' and '#' are causing the url to not be complete. Is there a special way to handle those special characters?

Thanks,

Randal
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Postby sharingsunshine » Thu Dec 24, 2009 10:07 am

anyone, please?
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am

Re: Change Url With A Query

Postby Jez » Wed Dec 30, 2009 2:03 pm

sharingsunshine wrote:Hello,

I am trying to remove the /fr in the url listed below. The topic and msg number change.

# http://www.anydomain.com/fr/smf/index.p ... icseen#new



Add this line to your .htaccess file:

Redirect /fr/smf/ /fr/
Jez
 
Posts: 2
Joined: Fri Dec 31, 2004 5:28 pm

Postby sharingsunshine » Tue Jan 12, 2010 8:23 am

Thanks for the suggestion.

However, I couldn't get it to work. I did figure this one out and it worked:

RedirectMatch 301 ^/fr/smf/index.php$ /smf/index.php
sharingsunshine
 
Posts: 55
Joined: Tue Dec 19, 2006 5:32 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 1 guest

cron