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.
Related
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.
I have the following vhost below, my goal with him is:
Redirect all access to https (OK)
Configure my ssl certificate (OK)
Remove www from url
I still can not configure my vhost to remove the www and force the url (using 301) to the url without the www
<VirtualHost *:80>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L]
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /usr/local/ssl/api_site_com.crt
SSLCertificateKeyFile /usr/local/ssl/myserver.key
SSLCACertificateFile /usr/local/ssl/api.site.com.cer
ServerName api.site.com
ServerAlias www.api.site.com
DocumentRoot "/var/www/api.site.com/public"
<Directory "/var/www/api.site.com/public">
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Could anyone help me?
I use these two lines to remove the 'www':
RewriteCond %{HTTP_HOST} !^example\.com [NC]
RewriteRule ^/(.*) http://example.com/$1 [R=301,L]
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>
If I put theese lines to .htaccess everything works well (when I'm going to http://www.example.ru I'm redirected to http://example.ru).
RewriteEngine On
# Installation directory
RewriteBase /
# Redirect all www to non-www
RewriteCond %{HTTP_HOST} ^www.example.ru [NC]
RewriteRule ^(.*)$ http://example.ru/$1 [L,R]
But If I put exactly same lines to <VirtualHost> -> <Directory> section trying to go to http://www.example.ru redirects me to http://example.ru/www.
Anybody knows why?
UPD
New VirtualHost:
<VirtualHost *:80>
ServerName example.ru
ServerAlias www.example.ru
ServerAdmin webmaster#localhost
DocumentRoot /home/example/www/example.ru/www
RewriteEngine On
<Directory /home/example/www/example.ru>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/example/www/example.ru/log/error.log
LogLevel warn
SetEnvIf Remote_Addr 127.0.0.1 loopback
CustomLog /home/example/www/example.ru/log/access.log combined env=!loopback
# Redirect all www to non-www
RewriteCond %{HTTP_HOST} ^www.example.ru [NC]
RewriteRule ^(.*)$ http://example.ru$1 [L,R]
</VirtualHost>
Spent some time I've figured out, that in VirtualHost section, pattern will match against the part of the URL after the hostname and port, and before the query string (in my case "/").
In Directory section, pattern will match against the filesystem path.
I have 2 urls say thinkingmonkey.me and thinkingmonkey.com both have ip-address 127.0.0.1 (A.K.A localhost).
I want to redirect any requests to thinkingmonkey.com to thinkingmonkey.me.
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot /mysite
ServerName thinkingmonkey.me
ServerAlias www.thinkingmonkey.me
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
Options -Indexes +FollowSymLinks
RewriteEngine On
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
ServerName thinkingmonkey.com
Redirect thinkingmonkey.com http://thinkingmonkey.me/
# Redirect / http://thinkingmonkey.me/ #have even tried this
ServerAlias www.thinkingmonkey.com
RewriteEngine on
</VirtualHost>
When I try to access thinkingmonkey.com the url does not get redirected to thinkingmonkey.me. The url in the brower's address bar remains thinkingmonkey.com.
What am I doing wrong?
mod_rewrite is considered better and more powerful to handle these rewrites. You can use following code:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*\.)?thinkingmonkey\.com$ [NC]
RewriteRule ^ http://%1thinkingmonkey.me%{REQUEST_URI} [L,R=301]
If you really-really want to use mod_aias you can put this line in VirtualHost section of thinkingmonkey.com:
Redirect 301 / http://thinkingmonkey.me/
Try this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !.*thinkingmonkey\.me$
RewriteRule ^/(.*)$ http://thinkingmonkey.me/$1 [R]
The documentation: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html