creating an error page-404 - .htaccess

I've registered my friends website and created it from names.co.uk, the website is (http://www.boillixbaits.co.uk)
I have followed their instructions from their support page as this is my first time trying to create an error page (http://www.names.co.uk/support/hosting/support_centre/linux_hosting/1255-how_to_add_custom_404_error_pages.html)
I followed every step exactly but for some reason this didn't work? Has anyone got any friendly advice or better still what I need to do to make an error-page work when the wrong address is typed in?
Many thanks in advance :)

What you want to do is go to the root of your site (the "public_html" folder, or the "www" folder, in your FTP program. Then you want to make a file called ".htaccess". Not "something.htaccess" or "custom.htaccess", just ".htaccess". In that file, you want to put:
ErrorDocument 404 /404.html
the "/404.html" should be an absolute path to your 404 file. So if your 404 file was in "public_html/files/custom404.html", you would put "/files/custom404.html"

Related

apache url completion suffix

a simple question. I've a file named xyz.php on the domain http://mybeautifulsite.com. Url is http://mybeautifulsite.com/xyz.php
When i type http://mybeautifulsite.com/xyz.php all is right good.
But if i type without php : http://mybeautifulsite.com/xyz I've a 404 error
What onfiguration is missing ?
Thank you
This is because of the way webservers work. without the .php the internet browser is assuming that xyz is a folder with an index.html. So its interpreting it as
http://mybeautifulsite.com/xyz/index.html

.htaccess and magento

I am trying to use .htaccess to handle the 404s but for some reason the default page CMS/indes/noRoute keeps interfering, is there a way to change magento's 404 using .htaccess instead of that default no-route, the idea is to send the 404s a search result containing the keywords they were looking for. I got it to work on other sites before but on magento they have a strange way of handling 404s and I don't know how to get around it.
One possible way to do this is by rewriting the Mage_Core_Controller_Varien_Router_Default class, which is doing the redirect to noroute. You could redirect to your own controller, which is showing the search results.
Yes sure you can do it with .htaccess.
Please try the following code in your .htaccess file.
ErrorDocument 404 http://demowebsite.com/custom404error.php
The custom404error.php can be whatever webpage you want to display as your 404 error. This trick worked for me.

URL rewrite rule in the same file (using anchor-lists)

I´ve just made a website based upon an only index.html file. You can surf the file using the menu that is made of anchored lists. The problem is that the URL is the name of the anchor, so I have two options:
1.- Rename the whole anchored lists (but there would be still some problems)
2.- Rename the URL using .htaccess, doing RewriteEngine On.
The URL you can see when access to the homepage is:
http://domain.com/#!/page_home
Notice: Only 'domain.com' is not real.
And next 'pages' are then:
http://domain.com/#!/page_2
http://domain.com/#!/page_3
http://domain.com/#!/page_4 and so on...
And I want to be displayed http://domain.com/welcome instead http://domain.com/#!/page_home.
Well, I´ve follow some basic and advanced tutorials with no luck. In theory using something like this should work:
RewriteEngine On
RewriteRule ^#!/page_home welcome
But this and others combinations didn´t work for me.
.htaccess is working because I have another rules like this one:
Options -Indexes
ErrorDocument 404 /notfound.html
Can you give me a hint please?
Thanks in advance.
I'm sorry to tell you this, but it won't work.
As you know already, anchor is a link to an internal resource in a web page. When you click on an anchor, no request is sent to the server, only the browser goes to the requested resource in the same page. If no request is sent to the server, then no htaccess is called and no redirections are made.
Your only option if you want the links to be like that is to redo the website without using anchors ...

Access denied on 1&1 server

I am having a problem with hosting a website on a 1&1 server (Bought package is SmartWeb M). I uploaded everything to the public_html folder (before you ask - yes, index.html is located in the document root and not one of the subfolders). When I then try to call the page in a browser I get the following error:
Forbidden
You don't have permission to access /index.html on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Since I couldn't find any .htaccess on forehand I created one in hope that that would fix it - nothing.
I have been waiting for an answer from the 1&1 help desk in more than 3 days now and I am moderately angry at their service.
Could anyone help me with this?
Thanks!
It turns out, that my files did have the wrong permissions. Make sure to get them to -755!

.htaccess 404 redirect to php file

I am currently trying to create a .htaccess file that redirects to a php file if a error 404 occurred.
However, When I choose a php file it just displays the default 404 not found error, but if i change it to html it then works fine and displays my page.
What is wrong with this.
Thanks for your help
Sadly there isn't enough to go on here, but I can give you some questions to help you debug this (too much for a comment otherwise I would have done that):
If you navigate to the php file is it hosted through Apache correctly (when not being used as an ErrorDocument)?
Are there errors in your apache logs from trying to retrieve the php file as an error document?
Is the "default" 404 error the one from Apache or your browser?
If it's Apache's does it say there was an error retrieving the configured error document?
If it's the one from your browser is the php file large enough to not be om nom nommed by the browser (for example: 512 bytes in IE )?

Resources