Can we escape a "?" and "=" like charact

Discuss practical ways rearrange URLs using mod_rewrite.

Can we escape a "?" and "=" like charact

Postby vinay.chilakamarri » Fri Jun 27, 2008 2:52 pm

Hi,

I was going through Yahoo REST API and was intrigued by one URL pattern:

http://local.yahooapis.com/MapsService/ ... e&state=CA


In this pattern, they use some special characters like "?" and "=", which convey some meaning when the mod rewrite parses it. Is there a way to
map these things to some dynamic page? Lets say

"geocode?appid=YD-9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA--&street=701+First+Ave&city=Sunnyvale&state=CA"

This portion is sending params...how do we pattern match this in .htaccess?
vinay.chilakamarri
 
Posts: 10
Joined: Fri Jun 20, 2008 4:42 pm

Postby vinay.chilakamarri » Fri Jun 27, 2008 3:44 pm

I figured it. Here is a sample example:

Lets say the URL is like:

https://localhost:491/?name=something


Here is how I wrote my .htaccess:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^name=([^/]+)$
RewriteRule ^$ /%1.xml [L]



One thing I learned here was % is the back reference for RewriteCond and $ is for rewrite rule.
vinay.chilakamarri
 
Posts: 10
Joined: Fri Jun 20, 2008 4:42 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 81 guests

cron