Dodger42
asked on
Apache redirects
Hey there,
Wondering if its possible with apache to configure redirection as follows:
source = localhost -> /
source = anything else -> /clients
??
Sorry for the newb question! :)
Wondering if its possible with apache to configure redirection as follows:
source = localhost -> /
source = anything else -> /clients
??
Sorry for the newb question! :)
the variable for client requests host is %{REMOTE_ADDR} .
so for you something like:
RewriteCond %{REMOTE_ADDR} ! ^127\.0\.0\.1$ #if request host is diffrent than 127.0.0.1
RewriteRule ^/$ http://<domainname>/client/ [L,R] # redirect / request to <domain>/client
so for you something like:
RewriteCond %{REMOTE_ADDR} ! ^127\.0\.0\.1$ #if request host is diffrent than 127.0.0.1
RewriteRule ^/$ http://<domainname>/client/ [L,R] # redirect / request to <domain>/client
ASKER
Would that be with mod_rewrite, or standard conf?
mod_rewrite.
and you have to enable rewrite with:
RewriteEngine on (just before the other rewrite directives).
sorry, forgot to ask if you have mod_rewrite installed......
and you have to enable rewrite with:
RewriteEngine on (just before the other rewrite directives).
sorry, forgot to ask if you have mod_rewrite installed......
ASKER
I have enabled the rewrite module. Do I put the RewriteEngine on directive and rules in the .htaccess file?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Or I presume it is also fine to put this in the <Directory> section if im not using a virtualhost?
Thanks.
Thanks.
above the <directory> section will be fine...
ASKER
I tried that but got a 404 error. I tried turning on logging as follows:
RewriteLog "d:/www/rewrite.txt"
RewriteLoglevel 0
But when I do that, apache fails to start.
All lines are before the directory section.
RewriteLog "d:/www/rewrite.txt"
RewriteLoglevel 0
But when I do that, apache fails to start.
All lines are before the directory section.
go to the bin directory of apache and type : apache -t . or look in error log why it dosn't start. my guess is that it can open the log file
ASKER
Aparrently (I read) even if apache cant open the log file, it wont tell you with apache -t.
ASKER
And the file definitely exists.
apache -t tests apache configuration and reports errors.
also is start fails the errror is somewhere in logs.
also is start fails the errror is somewhere in logs.
ASKER