I have virtualmin setup on my system. It currently points to https://here.domain.tld:10000
I want to have a rewrite rule that says when I hit https://here.domain.tld:10000 or here.domain.tld, to rewrite the url to be https://overthere.domain.tld:10000
I have tried the following in httpd.conf (centos) and none seem to work. I also tried setting these in the documentroot directory within an .htaccess file and nothing
RewriteEngine On RewriteCond %{HTTP_HOST} ^here.domain.tld$ [NC] RewriteCond %{REQUEST_URI} ^/$ RewriteCond %{SERVER_PORT} ^10000$ RewriteRule ^(.*) https://overthere.domain.tld:10000
RewriteEngine On RewriteCond %{HTTP_HOST} ^here.domain.tld$ [NC] RewriteRule ^(.) https://here.domain.tld:10000 [NC] RewriteRule ^(.) https://overthere.domain.tld:10000
RewriteEngine on RewriteCond %{HTTP_HOST} !^here.domain.tld [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^10000$ RewriteRule ^/(.*) https://overthere.domain.tld:%{SERVER_PORT}/$1 [L,R]
RewriteEngine on RewriteCond %{HTTP_HOST} =here.domain.tld RewriteRule ^(.) https://here.domain.tld:10000 [R] RewriteRule ^(.) https://overthere.domain.tld:10000 [R]
try RewriteEngine on
RewriteCond %{HTTP_HOST} =here.domain.tld
RewriteRule ^(.*) https://overthere.domain.tld:20000 [R]
Ronald,
That didn't work either. It's almost as if the rewrite module isn't installed but it is. I am supposed to do this in the main httpd.conf file, correct? I even tried it in the .htaccess file and my AllowOverride in httpd.conf is set to ALL
the rule should be working as it is in my system.
here is a part in http.conf on my system
< VirtualHost 213.xxx.xx.xx:80>
SuexecUserGroup "#512" "#502"
ServerName domain.nl
ServerAlias www.domain.nl
ServerAlias webmail.domain.nl
ServerAlias admin.domain.nl
DocumentRoot /home/domain.nl/public_html
ErrorLog /home/domain.nl/logs/error_log
CustomLog /home/domain.nl/logs/access_log combined
ScriptAlias /cgi-bin/ /home/domain.nl/cgi-bin/
ScriptAlias /awstats /home/domain.nl/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
< Directory /home/domain.nl/public_html>
Options Indexes IncludesNOEXEC FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/domain.nl/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/domain.nl/fcgi-bin/php5.fcgi .php5
< /Directory>
< Directory /home/domain.nl/cgi-bin>
allow from all
< /Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.domain.nl
RewriteRule ^(.) https://sv01.domain.com:20000 [R]
RewriteCond %{HTTP_HOST} =admin.domain.nl
RewriteRule ^(.) https://sv01.domain.com:10000 [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
< Files awstats.pl>
AuthName "domain.nl statistics"
AuthType Basic
AuthUserFile /home/domain.nl/.awstats-htpasswd
require valid-user
< /Files>
< /VirtualHost>
Ronald,
Your example seems to be for other virtual domains and not for the main apache domain. I need to have the rewrite rule for the systems administrator virtualmin panel. So, my install (not client's domains) was set by default to go to myhostname.domain.tld:10000. I want to change that to newsub.domain.tld:10000
Ronald,
Ok, I got it, I didn't realize I had to add it within someones virtualhost. Thanks for the help :)