Jump to content

put path into a variable?


ohdang888

Recommended Posts

ok so i have set up wildcard subdomains on my VPS, and this current mod_rewrite code is working great.

 

EXCEPT: say i have this url:

http://test.domain.com/current/path

 

I want that to go to index.php?siteName=test&request=/current/path

 

right now, what i'm getting (i know this by print_r($_GET)), is siteName=test (works great), but request=index.php

 

Whats wrong here?

 

Any help is greatly appreciated,

Thanks

 

<IfModule mod_rewrite.c>

  Options +FollowSymLinks

  Options +Indexes

  RewriteEngine On

  RewriteBase /

 

  RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]

  RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]

  RewriteRule (.*) index.php?siteName=%2&request=$1 [L]

 

</IfModule>

Link to comment
https://forums.phpfreaks.com/topic/223236-put-path-into-a-variable/
Share on other sites

How about:

 

  RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]

  RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com(.*) [NC]

  RewriteRule .* index.php?siteName=%2&request=%3 [L]

 

 

 

http://testing.domain.com

No it outright fails to do anything... :(

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.