Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite problems

Status
Not open for further replies.

compu73rg33k

Technical User
Nov 27, 2005
2
US
Okay so I used to have this which works.

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} !^([URL unfurl="true"]www\.)[/URL]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com
RewriteRule . /home/me/public_html/gay.php?name=%1 [L]

That right there successfully rewrites subdomains. Everything's good.

Now I want to add an image argument to the end of the url, and have it rewrite it with it. So where blah.domain.com would rewrite to /home/me/public_html/gay.php?name=blah I now want blah.domain.com/?image=2 to rewrite to /home/me/public_html/gay.php?name=blah&image=2. I thought this shouldn't be TOO hard, but it's cost me hours of different attempts. My latest which I def thought would work, is
Code:
RewriteEngine On

RewriteCond %{HTTP_HOST} !^([URL unfurl="true"]www\.)[/URL]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com/?image=([^.]+)
RewriteRule . /home/me/public_html/gay.php?name=%1&image=%2 [L]

Right now this just rewrites to the index.php file.

Anyone know how I can sucessfully accomplish this?

Thanks.
 
Hi

Usually this is a great help, if no success, come back with log details :
Code:
RewriteLog /var/log/httpd/rewrite_log
RewriteLogLevel 9
Note : set the loging back to off after debuging. Level 9 is abit CPU expensive.

Feherke.
 
I actually just appended [QSA] to the end of the rewrite url and it does what I need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top