The .htaccess file I have is unable to find my 404.html document in a sub-folder called "error". The line in particular is:
ErrorDocument 404 /error/404.html
However, if I place 404.html in the same directory as .htaccess and change the line to:
ErrorDocument 404 /404.html --- It works!
I'm using XAMPP for Windows if that helps, and in my httpd.conf file, the relevant directives are set as follows (I realize there is some redundancy):
<Directory />
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
AllowOverride All
Require all granted
</Directory>
Also, my DocumentRoot is set to "C:/xampp/htdocs", and I'v tried various paths to access the "error" directory--none work:
ErrorDocument 404 /error/404.html
ErrorDocument 404 /flchi/error/404.html
ErrorDocument 404 /sites/flchi/error/404.html
ErrorDocument 404 /htdocs/sites/flchi/error/404.html
Oh, and one final thing for what it's worth--I'm using virtual hosts. Here's the relevant bits:
<VirtualHost *>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost flchi.local>
DocumentRoot "C:/xampp/htdocs/sites/flchi"
ServerName flchi.local
ServerAlias flchi.local
<Directory "C:/xampp/htdocs/sites/flchi">
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This happens because of naming conflict - default Apache configuration already defines virtual path for /error, affecting all virtual hosts globally. It's done in config file xampp/apache/conf/extra/httpd-multilang-errordoc.conf. Location /error, therefore shadows your /error subdirectory:
Alias /error/ "C:/xampp/apache/error/"
It should work if you rename your 'error' sub-directory to something else - for example, error2.
ErrorDocument 404 /error2/404.html
Related
I have configured some vhost like:
<VirtualHost *:443>
ServerName test.mywebsite.com
ServerAlias test.mywebsite.com
DocumentRoot /hosting/test
<Directory "/hosting/test">
AllowOverride All
Order Allow,Deny
Allow from All
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile /usr/local/apache/ssl/mywebsite.com.pem
SSLCertificateKeyFile /usr/local/apache/ssl/mywebsite.com.key
</VirtualHost>
Now i need to display a default webpage if domain root folder not have any index page like index.php or index.html.
Actualy if open wesite it return 403 forbidden if index.html/php is not present.
My idea is;
Folder site no index.html/php show:
defaultwebpage.html in /etc/var/http/hdocs/default.html
How to this?
Apache config.conf is configured with default root but if put the index.html here it is not displayed in case of lack.
DocumentRoot "/data/www/default"
<Directory "/data/www/default">
Couldn't you use the ErrorDocument thing to redirect all 404 to a certain default page? If that default page is outside your webroot use alias to bring it in.
So
Alias /specialindex /etc/var/http/hdocs/
and
ErrorDocument 403 /specialindex/default.html
Looks strange, but should work. But, catches all 403 of course...
The solution:
<LocationMatch "^/+$">
Options -Indexes
ErrorDocument 403 /.noindex.html
</LocationMatch>
<Directory /usr/share/httpd/noindex>
AllowOverride None
Require all granted
</Directory>
Alias /.noindex.html /usr/share/httpd/noindex/index.html
Hi installed wordpress as localhost on my machine. I wanted to access it from another machine on my LAN. I can access the page. But non of the images or css is applying, Looking in firebug it's riddled with 404 errors to all the files it required. the path specifies the IP and not Localhost and exist in their locations.
I am trying to set apache to allow file browsing via the website I have set HTTPD.CONF and .htaccess but cant get file browsing the site is located at c:\xampp\apache\htdocs
heres what I have in httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
AllowOverride all
Require all granted
</Directory>
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory "/wordpress">
AllowOverride all
Require all granted
Options Indexes FollowSymLinks
</Directory>
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/wordpress/index.php"
ServerName wordpress
</VirtualHost>
in .htaccess
Options +Indexes
the error.log doesn't contain anything that stands out to me
You have to specify the option +Indexes in the corresponding Directory:
<Directory "C:/xampp/apache/htdocs">
Options +Indexes
</Directory>
I am trying to set up a rails app(redmine) on Ubuntu 14.10 running apache2.
log
Cannot server Directory: No matching DirectoryIndex
(index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found,
and server-generated directory index forbidden by Options directive
host.confg
<VirtualHost *:80>
ServerAdmin kanishka#thewolf.in
ServerName app.in
ServerAlias app.in
DocumentRoot /var/www/app.in/public_html/
ErrorLog /var/www/app.in/log/error.log
CustomLog /var/www/tribeapp.in/access.log combined
<Directory /var/www/app.in/public_html/redmine/public>
Options Indexes FollowSymLinks MultiViews
Require all granted
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
Order allow,deny
allow from all
AllowOverride all
</Directory>
</VirtualHost>
New to rails. Let me know if you need more info.
Try this
Options All <--turn on all options
Options Indexes FollowSymLinks <--- replace previously set options with these two
So, I have just found something I've missed about Apache ...
I have 3 sites:
/var/www/site1files (www.site1.com)
/var/www/site2files (www.site2.com)
/var/www/site3files (www.site3.com)
Each have an index.html ...
Now, when I go to each site, they work as expected ...
But, if I go to www.site1.com/site2files/index.html, strangely, it brings up that file (www.site2.com/index.html) ... Surely there's something really wrong I've done with my configuration ...
apache.conf (all default with):
<Directory /var/www/site1>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/site2>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/site3>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
And each has a conf file in enabled-sites:
<VirtualHost *:80>
ServerAdmin admin#site1.com
ServerName site1.com
ServerAlias www.site1.com
DirectoryIndex index.html
DocumentRoot /var/www/site1
<Directory /var/www/site1>
Options +FollowSymLinks -MultiViews -Indexes
AllowOverride None
Order allow,deny
allow from all
Require all granted
ErrorDocument 403 /404.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
</Directory>
</VirtualHost>
Okay, it seems I was confused about how to set up apache ...
I removed the site1,site2 and site3 <Directory> blocks from the apache.conf file, and just left the conf files in enabled sites ... Kinda makes sense now that I think about it ...
Remedial apache documentation reading for me ...
I installed Moveable type on a ubuntu box.
The admin section works great.
However the front page does not. The images and CSS are not displayed.
This is coming from the apache error log:
Permission denied: exec of '/var/www/mt/example/styles.css' failed
Premature end of script headers: styles.css
I think it's related to my apache config. Since i call the admin section using the localhost, but i use the example.com for the front page, which is the part that doesnt work.
This is my apache config:
NameVirtualHost *
<VirtualHost *>
ServerAdmin chris#example.com
ServerName mt.example.net
DocumentRoot /var/www/mt
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias / /var/www/mt/
<Directory /var/www/mt>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerAdmin chris#example.com
ServerName example.com
ServerAlias example.com www. example.com
DocumentRoot /var/www/example
Alias /mt-static /var/www/mt/mt-static
<Directory /var/www/mt/mt-static>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Redirect /mt.cgi http://mt.example.net/mt.cgi
</VirtualHost>
it because the directory where the css file is located (var/www/mt/example/) is a sub-directory of one which is declared to be a script in (/var/www/mt) with Options +ExecCGI
Directories inherit the options of their parents
It sounds like Apache has tried to run the .css file as an executable. The only thing which I can suggest is that you might have a css file which has an executable permission, for some reason, so Apache tries to execute it. Try
chmod a-x
on the CSS file and see if it makes a difference.
Sometimes files copied from Windows have executable set when they shouldn't.