I am having two domains example xyz.xx and pqrs.net and pointing to same IP.
xyz.xx apache htaccess configuration was done long back and running perfectly fine with this config
Listen : 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin testacc#gmail.com
DocumentRoot /www/docs/xyz.xx
ServerName xyz.xx
ServerAlias www.jxyz.xx
<Directory "/www/docs/xyz.xx">
AllowOverride None
Options All
Order allow,deny
Allow from all
DirectoryIndex index.php index.html index.htm
</Directory>
JkMount /test/*.jsp router
JkMount /test/*.html router
</VirtualHost>
Now I am trying to configure htaccess for pqrs.net but facing difficulties , Not sure why it is happening.Need Help.
Here is my other part of htaccess configuration added for pqrs.net:
Listen : 8081
NameVirtualHost XXX.XX.XX.XX:8081
<VirtualHost XXX.XX.XX.XX:8081>
ServerAdmin hello#gmail.com
DocumentRoot /www/docs/pqrs.net
ServerName pqrs.net
ServerAlias www.pqrs.net
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_REFERER} !^$
RewriteRule ^/$ /xxx/usa/index.html [L,PT]
RewriteCond %{REQUEST_URI} !^/xxx/.*
RewriteCond %{REQUEST_URI} !^.*\.do.*
RewriteRule ^/(.*) /xxx/$1 [L,PT]
JkMount /property/*.jsp xxxrouter
JkMount /property/*.html xxxrouter
<Directory "/www/docs/">
AllowOverride None
Options All
Order allow,deny
Allow from all
DirectoryIndex index.html
</Directory>
</VirtualHost>
and here is my workers.properties
worker.list=router
worker.list=xxxrouter
worker.xxxrouter.port=8011
worker.xxxrouter.host=localhost
worker.xxxrouter.type=ajp13
worker.xxxrouter.reply_timeout=100000
worker.router.port=8009
worker.router.host=localhost
worker.router.type=ajp13
worker.router.reply_timeout=100000
Please help me on this , when i am trying to access pqrs.net , it shows me this error message on browser.
The requested URL /xxx/usa/index.html was not found on this server.
Related
My site is not reading the htaccess file. Even if I add Deny from all at the top, the site loads fine.
Permission is 644. I have a number of sites running on the server so Apache is set up correctly.
This is my virtualhost config:
<VirtualHost 12.34.56.78:80>
ServerAdmin webmaster#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example.com/public_html/
<Directory /srv/www/example.com/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /srv/www/example.com/logs/error.log
CustomLog /srv/www/example.com/logs/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
This is what I'd added to .htaccess file to redirect www to non-www:
RewriteCond %{HTTP_HOST} ^(www\.)(.*) [NC]
RewriteRule (.*) https://%2%{REQUEST_URI} [L,R=301]
I tried adding it to virtualhost as well but it's still not redirecting.
After issuing an SSL Certificate with Let's Encrypt I had noticed it had created a duplicate conf file for port 443:
/etc/apache2/sites-available/example.com.conf
/etc/apache2/sites-available/example.com-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost 12.34.56.78:443>
ServerAdmin webmaster#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example.com/public_html/
<Directory /srv/www/example.com/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /srv/www/example.com/logs/error.log
CustomLog /srv/www/example.com/logs/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Prior to the LE, the original example.com.conf didn't have the AllowOverride All directive. So I assume what has happened is the contents were duplicated and then I only changed the original one.
I am using this code in httpd.conf
<VirtualHost *:4080>
# This will enable the Rewrite capabilities
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/ca.crt
SSLCertificateKeyFile /etc/pki/tls/private/ca.key
ServerAdmin serveradmin
DocumentRoot "/etc/zpanel/panel/"
ServerName panel.mydomain.com
ServerAlias *.panel.mydomain.com
AddType application/x-httpd-php .php
<Directory "/etc/zpanel/panel/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I need http://domain.com:4080 to redirect to secure ://domain.com:4080, which is happening but certificate is not working
If I remove the auto redirection code
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) [https://%{HTTP_HOST}%{REQUEST_URI}][1]
and goto secure: //domain.com:4080 in browser myself certificate shows up.
I need something like cpanels auto redirection to https
Try http://ziing.net:2087/
I have a site called mailcake.com, and I would like to have beta.mailcake.com, to redirect to mailcake.com, How can I achieve this? I have it like this on /etc/httpd/conf.d/mailcake.conf
NameVirtualHost *:443
<VirtualHost *:80>
DocumentRoot /var/www/mailcake
ServerName mailcake.com
ServerAlias www.mailcake.com beta.mailcake.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^beta\.mailcake\.com$ [NC]
RewriteRule (.+)$ "http://mailcake.com" [L,P]
ErrorLog /var/log/mailcake.com-error_log
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/mailcake
ServerName mailcake.com
ServerAlias www.mailcake.com
SSLEngine on
SSLCertificateFile /var/www/mailcake.crt
SSLCertificateKeyFile /var/www/mailcake.key
ErrorLog /var/log/mailcake.com-error_log
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
but it does not work
The following seems to work when tested with a few URLs:
RewriteCond %{HTTP_HOST} ^(beta\.)?mailcake\.com
RewriteRule (.*) http://mailcake.com/$1 [QSA]
Part of the important bit here is adding the $1 to ensure that any paths get added to the URL (in your example, http://beta.mailcake.com/stats/ would get redirected to http://mailcake.com/, which possibly isn't desireable. Also, adding [QSA] should ensure any query strings are passed along too.
If you're doing the redirect within the httpd.conf, I probably also wouldn't add [L], as it could stop other valid redirects within any .htaccess files from working.
i have specific rewrite like
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule .* /app_dev.php
and i need domain names like hello.epsilon.localhost and example.epsilon.localhost will go to epsilon.localhost virtualhost (sorry for my bad english)
full virtualhost for epsilon.localhost
<VirtualHost *:80>
DocumentRoot "C:/Projects/epsilon/web"
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule .* /app_dev.php
<Directory "C:/Projects/epsilon/web">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ServerName epsilon.localhost
</VirtualHost>
this rewrite for symfony 2.1
I'm using this http://sourceforge.net/projects/acrylic/ as a local DNS server on windows
and this in the Virtual host configuration
<VirtualHost 127.0.0.1>
ServerName devsite.localhost
ServerAlias *.devsite.localhost
DocumentRoot "C:/httpdocs/devsite"
</VirtualHost>
Can someone tell me why I can't view my index.php from the subdir /oorbellenboutique/?
It shows http:// www.oorbellenboutique.nl/startpagina/index.php, but it must be the index.php from f:/inetpub/wwwroot/oorbellenboutique
The correct URL is: http:// www.oorbellenboutique.nl/index.php
My DNS is:
A *.oorbellenboutique.nl → 83.87.163.224
A oorbellenboutique.nl → 83.87.163.224
CNAME www.oorbellenboutique.nl → oorbellenboutique.nl
My URL is: http://www.oorbellenboutique.nl
I'm running Apache 2.x
NameVirtualHost 192.168.0.199:80
NameVirtualHost 192.168.0.199:443
<VirtualHost 192.168.0.199:80 192.168.0.199:443>
ServerName oorbellenboutique.nl
ServerAlias www.oorbellenboutique.nl
DocumentRoot f:/inetpub/wwwroot/oorbellenboutique
RewriteEngine On
KeepAlive Off
DocumentRoot "f:/inetpub/wwwroot"
<Directory f:/inetpub/wwwroot/oorbellenboutique>
DirectoryIndex index.php
Order deny,allow
Allow from all
</Directory>
RewriteCond %{HTTP_HOST} ^(?:www\.)?oorbellenboutique\.nl$
ReWriteRule ^(.*) /oorbellenboutique/$1
</virtualhost>
This works but the URL is now:
http:// www.oorbellenboutique.nl/oorbellenboutique/index.php
How can I make the URL shorter like:
http:// www.oorbellenboutique.nl/index.php
NameVirtualHost 192.168.0.199:80
NameVirtualHost 192.168.0.199:443
< VirtualHost 192.168.0.199:80 192.168.0.199:443>
ServerName www.oorbellenboutique.nl
ServerAlias *.oorbellenboutique.nl oorbellenboutique.nl
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www.)?oorbellenboutique.nl$
<Directory f:/inetpub/wwwroot/oorbellenboutique>
DirectoryIndex index.html index.php
Order deny,allow
Allow from all
</Directory>
RewriteRule ^/$ /oorbellenboutique/ [R]
< /virtualhost>
Try adding a RewriteBase directive immediately following the RewriteEngine directive:
RewriteBase f:/inetpub/wwwroot
That is not the same as DocumentRoot for functionality -- it is needed for mod_rewrite.