NYCPHP Meetup

NYPHP.org

[nycphp-talk] OT - mod_rewrite Assistance

Joseph Crawford codebowl at gmail.com
Wed Apr 11 13:51:01 EDT 2007


Guys I know why this is acting the way it is, however I do not know
how to correct it.

## Rewrite something.domain.com/... to something.domain.com/...
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^((dev\.)(.+)\.)?(ere\.net)$ [NC]
RewriteCond $1 !^(index\.php|runtime|robots\.txt|assets)
RewriteRule ^(.*)$ http://%{HTTP_HOST}/%3%{REQUEST_URI} [QSA,L]

the 3rd RewriteCond says to run this is the first /something/ does not
match the ones in that list, so if i add /index\.php/ before the %3%
in the RewriteRule it works fine, however I wish to not have the
/index.php/ in the URL, yet I cannot list out all of the sub-domains
in that RewriteCond list. I tried to use %3% in the list but it
failed. It continued to run the rule.

The rule is running properly but never stopping until the browser
stops it. if you go to http://dev.sub.domain.com/ it will redirect you
to http://dev.sub.domain.com/sub/ but it goes continuosly adding more
and more /sub/ to the url.

Also i do not wish to show the url in the address bar. All i want to
show there is http://dev.sub.domain.com/ but in the background that
should rewrite to http://dev.sub.domain.com/sub/

So if i type in http://dev.sub.domain.com/folder/ in the background it
will actually be calling http://dev.sub.domain.com/sub/folder/

I hope I have explained the issues clearly.

Any help will be appreciated.

-- 
Joseph Crawford Jr.
Zend Certified Engineer
Codebowl Solutions, Inc.
http://www.codebowl.com/
Blog: http://www.josephcrawford.com/
1-802-671-2021
codebowl at gmail.com



More information about the talk mailing list