FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


404 redirects in XAMPP





sailor69
I am also trying to set 404 error redirects to "404.php" on localhost for Apache2.4/XAMPP in Windows 10. I have not located an ".htacess" file or equivalent. I have heard that editing "php.ini" may work but have not figured out how.
Peterssidan
If you don't have an .htaccess file you could create one.
sailor69
Peterssidan wrote:
If you don't have an .htaccess file you could create one.


I did so ("htacess.txt") after reading your post. Also, I got info from http://superuser.com/questions/56562/how-do-i-rename-a-file-to-htaccess-in-windows-7 that I thought would help.

I put both "htacess.txt" and "htacess.txt" in the htdocs directory for my site and in C:/xampp/apache/conf/ with only
Quote:
Configuration:404 error: "404.php"


404.php comes through fine, currently in the main site directory, when accessed directly in the url. But incorrect urls do not redirect to it.
Peterssidan
After you have created the .htaccess file you can remove htaccess.txt, it is no longer needed. Make sure to put it in the root directory of your site. Also make sure you spell it correctly with two c.

I think the content should be "ErrorDocument 404 /404.php" but maybe you need to use a different file path to locate the 404.php file, I'm not sure.
sailor69
It now seems that the pages do redirect to 404.php. However, the PHP code seems to get ignored.

It appears that redirects in CPanel are normally implemented as .shtml files in a directory above "public_html" which I do not have access to. I am planning on learning Angular JS for this reason.

As I recall, previous versions of CPanel or DirectAdmin made the use of .htaccess much easier through the use of an online form, in which the file is directly edited. However, I will attempt to do as you suggest.

I posted a response later the same day I started this thread on the same subject at http://www.frihost.com/forums/vt-162678.html. This may be considered double-posting, in a sense.

Edit: changed "earlier" to "later".
sailor69
It worked all the way. Shocked

I figured out that in File Manager I had to click on the directory name--not the icon--to access the directory. And I put in just "ErrorDocument 404 /404.php" in the file. It worked in the base directory, though not a subdirectory. I'll try in the subdirectory, probably with a "/../" to get the server to look in the base directory.

So I guess I was talking out of my ass. Embarassed Sorry

(This was on Frihost, which I think uses Unix, not Windows 10, which was my original question. I'll try in on my laptop, too.)
Marcuzzo
Frihost will mostlikely use linux.

it shouldn't matter if you click on a folder icon or a folder label in windows, so I'm not sure what you did there to make it work.

you seem to have posted the same text 3 times in 3 minutes apart Wink
sailor69
When I figure out what I did, I'll tell you, maybe in my next lifetime. It was in CPanel on Frihost that I was talking about. In another thread, I talked about having trouble with XAMPP on my computer, which is Windows 10.

I actually edited the post twice using the Edit button for the post. I was not aware that it could post that way. I did check the thread.
Related topics
.htaccess tutorial
Error 404 ..... How to Hide ...
XAMPP - All-in-One WebServer package
What do you think about my site its anime.
Slight Server Problem
Perl Script - Internal Error 404 File not found
IP for Virtual domain
Database on Frihost site
problem with site a.k.a. error 404
XAMPP FOR WINDOWS : V1.5.1 IS NOW AVAILABLE
creating error pages
Empanada de Apache con Xampp y AppServ rebozado con Dev-php2
Displaying A Default Page Not Found.
browser redirects 404 errors
Joomla 1.6 login form 404 page
Reply to topic    Frihost Forum Index -> Computers -> Operating Systems

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.