Regex Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreRegex Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 24th, 2008, 08:51 AM
ph33r's Avatar
ph33r ph33r is offline
if(x!="code"){die;
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: wheeling, wv
Posts: 47 ph33r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 22 m 43 sec
Reputation Power: 10
Send a message via Google Talk to ph33r
MySpace
REGEX help on url redirection with mod_rewrite

hey all,

im using an .htaccess file on my server to do url redirection. basically im hiding php server variables from the user w/ a mod_rewite trick. the code i have "works" but not quite the way i want it...

Code:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ info.php?x=$1&y=$2&z=$3
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ info.php?x=$1&y=$2&z=$3


so, if you enter this url:

http://www.mysite.com/xero/owns/us

that will display the content from

http://www.mysite.com/info.php?x=xero&y=owns&x=us

which is want i want it to do.
but, i want those 3 variables to be OPTIONAL!
so, if your typed in just /xero/owns it would do mysite.com/info.php?x=xero&y=owns&z= (null)

can any one point me in the right direction?

thanx!

-----------------[EDIT]------------------

i should have posted this in the apache forum.

also, i found the answer on this sticky

sorry!
__________________
+============+
| http://xero.nu |
+============+

Last edited by ph33r : September 24th, 2008 at 09:04 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreRegex Programming > REGEX help on url redirection with mod_rewrite

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap