Aucist  Others give up, I insist

 
How does .htaccess file work on Go Daddy, IX Web Hosting, or other Linux hostings?

Aucist posted on December 15, 2016 at 09:48

Before you upload the .htaccess file and program to Go Daddy, IX Web Hosting, or other Linux hostings, .htaccess file should be tested on your local harddisk first. .htaccess can change the active URL to a static URL, it looks like a static web page. And if you want to use .htaccess, you must choose Apache as the server platform. The usage of .htaccess file is not complicated, and not simple.

I'm a programmer, simply I'll introduce that how does .htaccess file work. First of all, I suggest that create a virtual hosting on local harddisk for your site to test, please view this I wrote http://www.auciou.com/peace/80 (How to create a virtual hosting on local harddisk.)

If you want to test .htaccess file on local harddisk, you must create a virtual hosting on local harddisk first. Why? Because once you use the 404 Error page, the root directory must be your site's folder. So it's very convenient to create virtual hostings on local harddisk.

.htaccess file takes effect for its folder, and its subfolder, and sub-subfolder, etc., so I suggest that if the functions of your site's folders are different, you can create a .htaccess file for every folder which you need to use 404 error page. Such as this blog, and this article's URL is http://www.ausue.com/dedicate/7, I create a folder "dedicate" and I create a .htaccess file at F:siteausue.comdedicate.htaccess, don't create it at F:siteausue.com.htaccess. The .htaccess file at F:siteausue.comdedicate.htaccess just write this one sentence:

ErrorDocument 404 /dedicate/abc.php

The program file is abc.php. This is a 404 error page example, and at first of abc.php, should write this one sentence:

header("Status: 200 OK");

If you use Rewrite mod, you needn't to write this sentence above. When upload this program to your site, you should check its status code. If it's 200 OK, it's normal. If it's 404 Not Found, you should continue checking your PHP program. The picture of this example as below:

A Rewrite example: create a .htaccess file at the same directory with the program file. Then write these 2 lines:

RewriteEngine On
RewriteRule (.+) abc.php

Such as one of my Blog programs:

Then you can access the web page as http://www.aucist.com/commence/trackback/8

0 Comment:

Post a comment:
Name: (* Required)
Blog: (Optional)

Comments:

    Remember? Yes No   Reply #

Post a trackback directly

© 2016-2018 aucist.com All rights reserved. Developed by Arsue