Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   httaccess question (https://www.warriorforum.com/programming/146097-httaccess-question.html)

danmart 18th November 2009 10:52 AM

httaccess question
 
is there a way to pass two variables thrugh a httaccess rdirect? I want to do something like somesite.com/go/1003/somethingelse to translate to go.php?var1=1003&var2=somethingelse.
If there is no /1003/ then var1 would = blank...

Anyone know how to do this?

Dan

Ryan Roxas 19th November 2009 02:38 AM

Re: httaccess question
 
you should be able to do that with mod_rewrite:

Start Rewriting : mod_rewrite tutorial

SecureWeb 19th November 2009 08:19 PM

Re: httaccess question
 
Try:

Code:

<IfModule mod_rewrite.c>
    # Sets User Groups and Login URL
    Options +FollowSymlinks All -Indexes
    RewriteEngine On
    RewriteBase /

    # Causes every request to run through your-script.php
    RewriteRule (.*)$ your-script.php?%{QUERY_STRING} [L]
</IfModule>

in your php check out the array $_SERVER

m4rx 19th November 2009 08:42 PM

Re: httaccess question
 
If you want a wonderful tutorial on mod_rewrite, you need to see .htaccess tricks and tips.. part two: url rewriting with mod rewrite.

Learned alot from this guy, and I know you will learn alot too.

--m4rx


All times are GMT -6. The time now is 12:58 PM.