htaccess ErrorDocument with Subdomains - .htaccess

So I recently tried to make my own 404 page. It looks good, but after hours of searching how to add it (didn't work), I give up... How can I get the same ErrorDocument on every subdomain with this structure?
/var/www
-main site
-.htaccess
-subdomain
-.htaccess
-error
-error***.html (*** = which error, 404 etc)
...
I tried inheriting .htaccess in /var/www, but it gives me a error:
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
How can i do this? Every try either just gave me "/error/404.html" as html or encountered an error. The document root is in the Subdomains folder, that's the problem. And going back a directory in .htaccess doesn't work (../error).

Well, it seems like it doesn't work. I've now just linked a error.php in every directory and there the htaccess links to them

Related

htaccess Help required redirecting old deleted links

I have a site (e.g. mysite.com) and old versions of the site under a directory are still appearing in search engines (e.g. mysite.com/oldsecton/something.html). There are too many of these links to remove from search engine finds.
I want everything in the /oldsection to redirect back to mysite.com/index.html
i.e. everything in the /oldsection should go to index.html located one directory path back
I have tried different variations of .htaccess inside /oldsection such as
ErrorDocument 404 ../index.html
ErrorDocument 404 mysite.com/index.html
etc...
None of them seem to be successfull.
This should be a simple task but I keep getting an Internal Server Error or a ErrorDocument error.
Inside /oldsection/.htaccess have this code:
RewriteEngine On
RewriteRule ^ /index.html [L,R=302]

404 Redirect Error with .htaccess

I'm running a website on a local server (using WAMP Server) and I'm trying to test to see if my 404 page would work, but when I try to navigate to a nonexistent page, I get an error that says:
The requested URL /dsf/sdkmf was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.
My 404 page is in the root folder with all my other pages and my .htaccess Error Document handle is listed as:
ErrorDocument 404 /404.html
I don't know why it's throwing me this error much less how to fix it, does it have something to do with my WAMPServer configuration?
Never mind - I figured out how to solve it on my own - apparently you have to use the direct path to the file - even if it's in the root directory of the site itself!

Enable mod_rewrite rules for page not managed by Joomla - 403 forbidden

I have a simple issue to resolve. Every time I access one of the URLs explicitly defined in .htaccess (used by Joomla), I'm getting 403 Forbidden message.
Details about my setup:
I'm using shared hosting
Joomla is installed in the root folder
my newly created page is located in /new/products.php
.htaccess is the default one supplied by Joomla with one additional rule: rewriterule $/new/products^ /new/products.php [R=301,L]
Options +FollowSymLinks is commented out, but switching it on doesn't change anything
Each time I access mysite.com/new/products I' getting:
Forbidden
You don't have permission to access /new/products/ on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.
Any ideas?
In the end I simply removed old site, cleared all Jooml entries in .htaccess and did RewriteBase to point to my directory. The problem is no more.

Use 404 ErrorDocument that is in a sub directory

I have a htaccess file in a sub folder like so:
/subfolder/.htaccess
In the htaccess file the following code to set a 404 ErrorDocument
ErrorDocument 404 /404.php
The issue is the 404 page in the root directory is loaded rather than the one in the /subfolder/ folder. I can't simply change the htaccess file to use /subfolder/404.php because the system is going to be installed in lots of different places.
Is there a way to reference the files in the directory that the htaccess is in?
I just had the same problem and found you page...If you have domain/folder and want to redirect anything from the folder back to the domain's index, use ErrorDocument 404 /
...I'm not sure if this goes to the root folder or one folder up, but in your case (and mine) they are one in the same.
Hope this helps!

404 custom error template .htaccess

Ok, I have a problem, my .htaccess code is:
RewriteEngine on
ErrorDocument 404 /notfound.html
and I have not found.html near .htaccess.
Why is it not working? I don't believe what I'm seeing. I took the tutorial from here
http://www.htaccessbasics.com/404-custom-error-page/
I just want that every time I access www.site.com/ajfasoijfiajsfijaofij to show what is it in notfound.html.
when using ErrorDocument , the file you're specifying is relative to DOCUMENT ROOT not .htaccess location!
Edit:
assume you have notfound.html and you want to use it for folder dir01, you create an htaccess file inside this folder and add this:
ErrorDocument 404 /dir01/notfound.html
If you want to access your file(notfound.html) in browser it would be http://www.example.com/dir01/notfound.html. that's all I could explain!
You can use in your .htaccess file the following code:
RewriteBase /

Resources