?q=STRING to %C3%96zel:Search?search=STRING&go=Git

Discuss practical ways rearrange URLs using mod_rewrite.

?q=STRING to %C3%96zel:Search?search=STRING&go=Git

Postby overflow » Tue Jun 03, 2008 11:52 pm

Hello

Old site: http://www.adres.com/?q=STRING
New site: http://www.adres.com/Search?search=STRING&go=Git

Code: Select all
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?q=([^&]+)(&.*)?$ [NC]
RewriteRule ^/(.*)$  /Search?search=$2&go=Git [NC,R=301,L]


http://www.adres.com/?q=STRING rewrite result
http://www.adres.com/Search?search=/&go=Git

How Can I Do Rewrite
overflow
 
Posts: 19
Joined: Thu Oct 12, 2006 2:02 am
Location: Turkey

Postby richardk » Thu Jun 05, 2008 3:56 pm

$n from RewriteRules.
%n from the last RewriteCond.

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STRING} ^(.*&)?q=([^&]+)(&.*)?$ [NC]
RewriteRule ^/$  /Search?search=%2&go=Git [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby overflow » Thu Jun 05, 2008 11:21 pm

thanks
overflow
 
Posts: 19
Joined: Thu Oct 12, 2006 2:02 am
Location: Turkey


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 65 guests

cron