"dynamic to static url" problem

Discuss practical ways rearrange URLs using mod_rewrite.

"dynamic to static url" problem

Postby sqm » Thu Nov 27, 2003 7:43 am

hi forum,

i'm trying to set up a general rewriterule that hides our template-based dynamic links behind static links.

http://domain.com/news.php?id=12&lang=en

should be

http://domain.com/rewrite/news/id/12/lang/en

so. all keys and values should be transformed to a path.

i've set up the following rule:

RewriteCond %{REQUEST_URI} rewrite
RewriteRule ^/rewrite/(.*)/(.*)/(.*)/(.*)/(.*)$ /$1.php?$2=$3&$4=$5

and i have no idea why it does not work

help, please!

manu
sqm
 
Posts: 2
Joined: Thu Nov 27, 2003 7:31 am

Check the error logs 1st

Postby Guest » Mon Dec 15, 2003 2:16 pm

I am not sure to much, about your problem, but I had trouble if my rewrite was in the wrong place, it wounld affect apache but it wouldn;t work either,
on mac - in place the information in the macosxserverhttpd.conf file in between the <virtualhost> </virtualhost>
restart. PC I think it is in the .htaccess file. and make sure it is turned on or the mod is running, check the logs.
Good Luck
Guest
 

Postby hswaseer » Tue Dec 30, 2003 3:25 am

Hi sqm

I am new to this forum as well to the mode_write. Even i want to have my url clean. I have tried this in my .htaccess file

RewriteEngine On
RewriteRule ^soccer/([a-zA-Z]+)([0-9]+)/? soccer.php?id=$2 [L]


but i am not able to make a break through

I want my url to look like this

www.example.com/soccer/page1

instead of

www.example.com/soccer?id=1

can u please tell me what to do ?


Thanks

HS
hswaseer
 
Posts: 1
Joined: Tue Dec 30, 2003 3:17 am
Location: India

Please : http://site.com/index.php?var1=a&var2=2 =>

Postby Guest » Sun Apr 04, 2004 3:37 am

Same please ...

Totally new to mod_rewrite, so maybe overlooking the obvious.

Can't find the basic stuff

http://site.com/index.php?var1=a&var2=2 =>
http://site.com/1/2
Guest
 

Re: "dynamic to static url" problem

Postby Mañungo » Fri Apr 16, 2004 12:53 pm

The first (.*) eats all URL... try with ([^/]*) == everything but /

RewriteCond %{REQUEST_URI} rewrite
RewriteRule ^/rewrite/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /$1.php?$2=$3&$4=$5
Mañungo
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 79 guests

cron