Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a structure like this
/ < root folder
/Site/Public/.htaccess
/Site/Public/index.php
/Site/Public/error.php
/Site/Public/images/chat.png
In my htaccess I have disabled access to subfolders and set a default 403 document like so:
ErrorDocument 403 error.php
Options All -Indexes
But the problem is that I cannot get it to pick that error.php file unless I use the full path starting from root. I also tried this
ErrorDocument 403 chat.png
And it doesn't pick that up either just displays a string in both situations. Can anyone tell me how to target that error.php file without using the absolute path?
The experimenting url is localhost/Site/Public/images
from http://httpd.apache.org/docs/2.2/mod/core.html#errordocument
URLs can begin with a slash (/) for local web-paths (relative to the
DocumentRoot), or be a full URL which the client can resolve.
Alternatively, a message can be provided to be displayed by the
browser.
any argument that is not a full url (http://www.example.com) or does not start with / will be treated as string.
The urls have to be defined relative to the DocumentRoot, which in your case seems to be the same for your sites.
Alternatively you can use full urls that can be resolved by the client.
That may be an alternative for you.
Everything else you need to know can be read in the manual:
http://httpd.apache.org/docs/current/mod/core.html#errordocument
Related
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a magento site which has index.php appended to the url you click on. I googled a lot to find the solution and i did what i could find.To clear my my doubts i uploaded htaccess file fresh copy from magento copy and made the url rewrite in configuation>system>web to yes and clear the cache too but still it put index.php in url.I have also double checked secure and unsecure link to see if it contain any index.php which it doesn't
I can do all what i can to do research and applied it but no change. What can i do or what can be wrong?
The steps you describe should be right:
System > Configuration > Web > Use Web Server Rewrites set to yes (also check the store view level value, because the scope for this is not global)
.htaccess present in document root
clear Magento cache
Additional things to check:
System > Configuration > Web > (Un)secure base url
does your Apache take into consideration .htaccess (AllowOverride)
how did you clear the cache
the scope for your settings System > Configuration > Web > Use Web Server Rewrites
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have a directory called /var/www/icons on my web server, which is also referenced as an alias in my Apache config as seen below:
Alias /icons/ "/var/www/icons/"
The directory contains a number of small PNGs and GIFs, which AFAIK are unused, along with a README file.
Am I safe to remove this alias from my Apache config by commenting it out? If not, what area of my application is the removal of this likely to effect?
There is very little documentation available on this directory and I must admit i've never came across it up until now.
Most icons are used for displaying file types in directory listings. If you do not use such listings, you can safely remove alias + files. I did so and do not miss them.
It is for sure safe to remove it. Other conf files could reference /icons (e. g. the autoindex module) but apart from some not found errors nothing nasty should happen.
My advice: scan the access.log files to see if urls rooted at /icons are accessed. Delete the alias and monitor the error.log file for 404 errors.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
this is my robots.txt. I want to only allow the base url domain.com for indexing and disallow all sub urls like domain.com/foo and domain.com/bar.html.
User-agent: *
Disallow: /*/
Because I am not sure whether this is a valid syntax I tested it using Google Webmaster Tools. It shows me this message.
robots.txt file is probably invalid.
Is my file valid? Is there a better way of only allowing the base url for indexing?
Update: Google downloaded my robots.txt 4 hours ago. I think thats why it doesn't work. I will wait some time and if the problem stays I will update my question again.
Here is a link to a validator. It might help you work through any errors in the file.
Robots.txt Checker
I checked on another validator, robots.txt Checker, and this is what I got for the second line:
Wildcard characters (like "*") are not allowed here The line below
must be an allow, disallow, comment or a blank line statement
This might be what you're looking for:
User-Agent: *
Allow: /index.html
Disallow: /
This assumes your homepage is index.html.
If index.php is your homepage, you should be able to swap out index.html for index.php.
User-Agent: *
Allow: /index.php
Disallow: /
On my dynamic websites that run through index.php, going to mydomain.com/index.php still takes me to the homepage, so the above should work.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do I change default Directory and index File for Apache (installed via XAMPP) so instead of looking for htdocs and index, it looks for myPath and myFile, respectively?
The research link you pasted has the first part of the answer to your question, changing the path you want serve but the second part of your question, making it serve "myFile" as the Index is an additional step. See:
http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex
So you would add this line inside the relevant tags or even loose in the main httpd.conf file (see the Context section of the above link for valid places to use this directive):
DirectoryIndex myFile.ext
Hope this helps.
Edit the httpd.conf file - the DocumentRoot directory can be updated to whichever directory you would like (and that the process has permissions to). See:
http://httpd.apache.org/docs/2.0/mod/core.html#documentroot
DocumentRoot /usr/web
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have few sites, and they all have identical setup on a single server. Now, instead of the separate configuration file for each of them in sites-enabled directory, I want to have a common file.
Idea is this:
www.abc.com should have /var/www/abc as DocumentRoot,
www.xyz.com should have /var/www/xyz as DocumentRoot, etc.
All other parameteres like log files, contact emails etc should also have identical setup (abc.com should have contact#abc.com as admin email, xyz.com should have contact#xyz.com as admin email etc).
I couldnt find any tutorial on how to backreference wildcards, etc.
regards,
JP
Aha. Found the solution. VirtualDocumentRoot is the answer.
A single line like:
VirtualDocumentRoot /var/www/%0
does the job. Havent really figured the logs stuff but should be similar and easy.
See https://serverfault.com/questions/182929/wildcard-subdomain-directory-names for a nice related thread.
You gotta enable vhost_alias module for this. (sudo a2enmod vhost_alias on ubuntu).