| 
	
 | 
 Posted by Alan Little on 06/26/06 11:31 
Carved in mystic runes upon the very living rock, the last words of deko  
of comp.lang.php make plain:  
 
> I'm trying to redirect requests for /index.php to 
> /mydirectory/index.php  
>  
> If I use an index file in / with only this line: 
>  
> <?php header("Location:http://www.mysite.com/mydirectory/"); ?> 
>  
> that seems to work. 
 
That will work, so long as that's all you want to redirect. However, if  
someone visits http://www.mysite.com/mydirectory/someoldfile.php, it  
won't. 
 
> But can this be accomplished more efficiently with an htaccess 
> rewrite?  
>  
> I already have this rewrite rule in my htaccess file: 
> RewriteEngine on 
> Options All -Indexes 
> RewriteCond %{HTTP_HOST} ^www.myoldsite.com$ [NC,OR] 
> RewriteCond %{HTTP_HOST} ^myoldsite.com$ [NC] 
> RewriteRule ^(.*)$ http: //10.10.10.10/ 
 
> This just sends requests for myoldsite.com into hyperspace, but allows  
> me to get email using that domain. 
 
..htaccess has nothing to do with email, only web requests. 
 
> How do I append to htaccess so that I can redirect requests for a 
> specific host to a particular directory? 
 
RewriteCond %{HTTP_HOST} ^www.example.com$ 
RewriteCond %{REQUEST_URI} !^/example/ 
RewriteRule (.*) /example/$1 
 
RewriteCond %{HTTP_HOST} ^example.com$ 
RewriteCond %{REQUEST_URI} !^/example/ 
RewriteRule (.*) /example/$1 
 
--  
Alan Little 
Phorm PHP Form Processor 
http://www.phorm.com/
 
  
Navigation:
[Reply to this message] 
 |