Please help me. Problems with rewrite url

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

Please help me. Problems with rewrite url

Postby khiemnd » Fri Jun 19, 2009 1:53 am

Hi!

I want to rewrite my website url from.

http://localhost/games/?page=5 to games.php?page=5

RewriteRule ^games/\?page=([0-9]+)$ /games.php?page=$1

Please help me!

Thanks in advance.
khiemnd
 
Posts: 3
Joined: Thu Jun 28, 2007 11:22 pm

Postby richardk » Fri Jun 19, 2009 10:25 am

Query strings are matched with the %{QUERY_STRING} variable and RewriteConds.

You probably only need the QSA (Query String Append) flag. It passes the query string from the browser URL to the internal URL. Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^games/?$ /games.php [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby khiemnd » Fri Jun 19, 2009 11:58 am

Hi Richard!

I have rewrite that rule in pager. Please tell me where wrong?

RewriteRule ^wapapp/games/list/([a-z0-9_]+)/?page=([0-9]+)$ /wapapp/games.php?do=games&task=list&part=$1&p=$3

Thank you very much!
khiemnd
 
Posts: 3
Joined: Thu Jun 28, 2007 11:22 pm

Postby richardk » Fri Jun 19, 2009 1:55 pm

Try
Code: Select all
options +FollowSymlinks

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(.*&)?page=([0-9]+)(&.*)?$ [NC]
RewriteRule ^wapapp/games/list/([a-z0-9_]+)/?$ /wapapp/games.php?do=games&task=list&part=$1&p=%2 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 108 guests

cron