Hello. I'm having trouble putting together a Mod Rewrite rules. I would do something like this:

This is the original address:

 http://www.domian.com/index.php?site_id=AAA&var1=value1&var2=value2&var3=value3...itd. [/ code]

[b] And that's different versions of changes to this address: [/ b]
A) Without the use of subdomains:
[code] has changed to this:
http://www.domian.com/AAA/index.php?var1=value1&var2=value2&var3=value3...itd.
OR for this:
http://www.domian.com/AAA/index/var1/value1/var2/value2/var3/value3...itd. [/ code]

B) The use of subdomains
[code] has changed to this:
http://www.AAA.domian.com/index.php?var1=value1&var2=value2&var3=value3...itd.
OR for this:
http://www.AAA.domian.com/index/var1/value1/var2/value2/var3/value3...itd. [/ code]

I wish I could saw all four versions, how to write such rules. With this var1 = value1 ... etc. I mean, that could be an infinite number of GET variables added. Let me add that I have on the server included Wildcrad.

Greetings,
ladovnik
    4 days later

    try this forum:
    http://forum.modrewrite.com/
    its a one man show I think, but he gives very good advice though you may need to wait a day or two

    .. that of course is if there isn't a top notch modrewriter able to help you here

    (I'm sure your problem can be solved quite easily)

      20 days later

      Here is some of my .htaccess code for PutPhoto, I use subdomains, multiple variables etc, maybe this will help you.

      rewriteCond %{REQUEST_URI} !^/index\.php
      rewriteCond %{HTTP_HOST} !^www\.
      rewriteCond %{HTTP_HOST} ^(.+)\.putphoto\.com
      rewriteRule ^$ /index.php?display=user&username=%1 [L]
      RewriteRule ^a/([a-z0-9_-]+)/([a-z0-9_-]+)/?$ index.php?display=gallery&id=$1&rndkey=$2 [L,NC]
      RewriteRule ^i/([a-z0-9_-]+)/([a-z0-9_-]+)/?$ index.php?display=gallery&imgid=$1&rndkey=$2 [L,NC]
      
      RewriteEngine On
      RewriteRule ^uploadzip.html/?$ /index.php?display=uploadzip [L]
      RewriteRule ^uploadzipstep1.html/?$ /index.php?display=uploadzipstep1 [L]
      RewriteRule ^simpleuploadstep1.html/?$ /index.php?display=simpleuploadstep1 [L]
      RewriteRule ^simpleuploadexisting.html/?$ /index.php?display=existingstep1 [L]
      

      In use: http://gordon.putphoto.com/a/546/5631961

        7 days later

        I don't think it will be possible to do the/var1/value1/ etc with mod rewrite since you need to loop through it. The best solution would be to route everything through your index.php file, and using $_SERVER['REQUEST_URI'] you can extract all the variables by exploding the string

          jay6390;10937975 wrote:

          I don't think it will be possible to do the/var1/value1/ etc with mod rewrite since you need to loop through it. The best solution would be to route everything through your index.php file, and using $_SERVER['REQUEST_URI'] you can extract all the variables by exploding the string

          This is how you use two variables.

          RewriteRule ^a/([a-z0-9_-]+)/([a-z0-9_-]+)/?$ index.php?display=gallery&id=$1&rndkey=$2 [L,NC] 

            lol I'm perfectly aware of how you use mod rewrite with variables, the problem is that there is no predefined number of them, so sometimes there might be two, others there might be 4

              Write a Reply...