http://www.mysite.com/index.php?pais=es-mx&nivel=1&i

Discuss practical ways rearrange URLs using mod_rewrite.

http://www.mysite.com/index.php?pais=es-mx&nivel=1&i

Postby danielazo » Tue Mar 15, 2005 8:41 pm

Hi

http://www.mysite.com/index.php?pais=es ... =1&id=1747
to
http://www.mysite.com/paises-mxnivel1id1747.htm

I have in htacces:
---------------------------
RewriteEngine on
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|css|swf|php|txt)$
RewriteRule (pais([a-zA-Z]))?(nivel([0-9]+))?(id([0-9]+))? index.php?&pais=$1&nivel=$2&id=$3 [L]
RewriteRule \.htm$ index.php
---------------------------

Can you help me?
danielazo
 
Posts: 2
Joined: Tue Mar 15, 2005 8:30 pm
Location: Salta

Postby Caterham » Wed Mar 16, 2005 3:59 am

there are some erreos in the pattern.

Do you need to make things optional? Because you're using
(....)?


You'll not need the Condition, the pattern of the RULE is processed before the Condition applies.

Code: Select all
RewriteEngine on
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^pais([a-zA-Z_-]+)nivel([0-9]+)id([0-9]+)\.htm$ index.php?&pais=$1&nivel=$2&id=$3 [L]
RewriteRule ^([a-z0-9_-])\.htm$ index.php [L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Thanks!

Postby danielazo » Wed Mar 16, 2005 6:36 am

Thanks you! :smile2:
danielazo
 
Posts: 2
Joined: Tue Mar 15, 2005 8:30 pm
Location: Salta


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 18 guests

cron