Jump to content

[SOLVED] How would I go about converting url params...


Fireye

Recommended Posts

... into a query?  I've seen several sites about that take say, www.stuff.com/view/washingtondc/10582 and interpret that to be a query instead of a physical directory.  I envision taking my current custom gallery script and reworking it to use a structure like that, where /view/washingtondc/10582 would equal my ?command=view&album=washingtondc&photo=10582 is currently.

 

Is that a function of apache, or can it be handled by PHP?  I really just need a direction to be pointed in, because I'm not quite sure how to phrase my question in a google-friendly manner :)

That is done by an apache module called mod_rewrite.  It is used to setup rewrite rules for urls using regular expressions.  Rewrite rules are kept in a .htaccess file at your site's root.  A typical .htaccess file looks something like this:

 


# begin mod rewrite
RewriteEngine on
RewriteBase /

# special pages
RewriteRule ^view/?([a-zA-Z0-9_\/]+)/?$ view.php?$1

 

So if I were you, I would look into mod_rewrite and PHP.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.