For example, the Host IP address is 192.168.1.1.
There are three domain names on your host:
Www.a.comPut webpage files in E:/web/www/1
Www. B .comPut webpage files in E:/web/www/2
Www.c.comPut webpage files in E:/web/www/3
Add httpd. conf to Apache
# Set different domain names to different directories
Namevirtualhost 192.168.1.1
ServernameWww.a.com
DocumentRoot "E:/web/www/"
ServernameWww. B .com
DocumentRoot "E:/web/www/B"
ServernameWww.c.com
DocumentRoot
, at least the directory must be set
Copy codeThe Code is as follows: AllowOverride FileInfo
2. Enable Options FollowSymLinks and AllowOverride All in the directory that supports url rewirte
Copy codeThe Code is as follows: Alias/php "c:/web/php /"
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
By using http: // localhost: 8080/php/, the/php/and its subdirectories support url rewrite.
1 AuthConfig allows all permission commands, including AuthDBMGroupFile AuthD
= "404 Not Found", so that the page returns a 404 Status code. 4. Set the 404 error page in Apache. Setting the 404 error page for Apache Server is simple. You only need to add the following content to the. htaccess file: ErrorDocument 404/notfound. php
Websites with 404 themes:404 is an HTTP access error, but some webmasters discovered business opportunities and created a "404-witty online Homepage ", the website only contains the basic search box,
it. When creating a file in Windows, the file cannot only have a suffix. You can use notepad or other tools to save it as the file name.
To rewrite a URL, the configuration file uses a regular expression to write a URL and map the sum of the regular PHP files. The common syntax is as follows:
RewriteEngine on // on is enabled, off is disabled
RewriteRule (%a-za-z%1,%%%-(%0-9%%1,%%%.html $ B. php? Action = $1 id = $2
RewriteRule ([a-zA-Z1-9] {1,})/([a-zA-Z1-9] {1,}) $ a. php? Controller = $1 a
the access control of all directories under the root directory is set by the. htaccess file under its directory.
Here, I want to talk nonsense.
Why is it. htaccess? this file name is not another one.
This is defined in the AccessFileName parameter. By default, this is the case.
AccessFileName. htaccess
You need to clear the allowoverride authconfig parameter (add # or delete)
Reasons for doing so
1. I am in trouble (a. htaccess file must be placed in each directory and a file name starting with
-the disposition header is used to provide a recommended file name and force the browser to display the Save dialog box):01PHP02Header("Content-type:application/pdf");03//the file will be called Downloaded.pdf04Header("Content-disposition:attachment;filename= ' downloaded.pdf '");05//PDF Source in Original.pdf06ReadFile("Original.pdf");07?>08Microsoft IE5.5 There is a bug that prevents the above mechanism. by upgrading to ServicePack2or a higher version, you can resolve the bug. There are two ki
. Htaccess defines 404 page problems. For the 404 page and the. htaccessfile question, click. htaccess, and you can find the errordocument404missing.html homepage. you need to confirm that your host supports. htaccess... to modify the conf file, restart the apache page and. htaccess file.
Create a. htaccess.ErrorDocument 404/missing.html
On the homepage, make sure your host supports. htaccess ..To modify the conf file, restart apache ..
It is not related to UrlRewrite. it mainly depends
, this is basically the case when parsing and allocating it to the specified class.The simplest method is to create a. htaccess file. Paste the file content to you
ErrorDocument 500 'mod _ rewrite must be enabled'
RewriteEngine on
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule ^ (. *) $ index. php
Put this file in the root directory. File function is obvious: transfer all request paths to index
Why is URLrewrite wrong? Lt; IfModule nbsp; mod_rewrite.c gt; RewriteEngine nbsp; OnRewriteBase nbsp;/forumRewriteRule nbsp; ^ (why is the error caused by Index | l url rewrite?
RewriteEngine On
RewriteBase/forum
RewriteRule ^ (Index | List | Content | admin | Vote | Message | Favor). *) $ index. php/$1
Prompt
Not Found
The requested URL/forum/List-index-f-2.shtml was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to
First take a look at the PHP instance code: @ header ( quot; http11404notfound quot;); @ header ( quot; status: 404 notfound quot;); echo amp; 39; echo404 amp; 39; exit (); check whether 404 is set successfully
Let's take a look at the PHP instance code:
@ Header ("http/1.1 404 not found ");
@ Header ("status: 404 not found ");
Echo 'echo 404 ';
Exit ();
To check whether 404 is set successfully, you can use the firebug plug-in of firefox to check the setting:
When fi
/block access by specified IP users, disable directory list, configure default documents, and other functions are very powerful, the following describes how to set the most common functions.
Set website error page
ErrorDocument 400/error_pages/400.htmlErrorDocument 401/error_pages/401.htmlErrorDocument 403/error_pages/403.htmlErrorDocument 404/error_pages/404.htmlErrorDocument 500/error_pages/500.html
Set webpage 301 redirection
# REDIRECT from the
of your website)ErrorDocument 401/error/401.phpErrorDocument 403/error/403.phpErrorDocument 404/error/404.phpErrorDocument 500/error/500.php2. set the time zone of the websiteSetEnv TZ America/Houston3. blocked IP listSometimes, you need to block some access by IP address. Whether it is an IP address or a network segment, this is a very simple task, as shown below:Allow from allDeny from 145.186.14.122Deny from 124.15Apache returns the 403 error for
header. It is replaced by default, but if it is set to FALSE, multiple similar headers can be forcibly sent. For example:
Header ('www-Authenticate: negotiate ');Header ('www-Authenticate: ntlm', false );?> The second optional parameter http_response_code sets the HTTP response code to a specified value (this parameter is newly added by PHP 4.3.0 ).There are two special header calls. First, the header starts with the string "HTTP/" (case insensitive) and can be used to determine the HTT
This article introduces the application of. htaccess and php pseudo-static in actual projects, some common code of php and apache pseudo-static 1. Setting image anti-Leech in htaccess
RewriteEngine on##################################################RewriteCond %{HTTP_REFERER} !^$RewriteCond %{HTTP_REFERER} !^http://(www\.)?php1.cn(/)?.*$ [NC]RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://nothing_phpcn[R,NC,L]##################################################################################Rewr
My environment is XAMPP 3.2.2+php5.6.19, when a non-local machine accesses phpmyadmin through an IP address, the error message appears as follows.
The workaround is to:
Locate the httpd-xampp.conf file, comment out require local, and change to require all granted.
Alias/phpmyadmin "c:/xampp/phpmyadmin/"
allowoverride authconfig #Require local Require all Granted errordocument 403/error/xampp_forbidde
What's the function of the PHP header function? In PHP, the header function can be used as two special headers to send the status code, you can replace the previous same type of header, you can also force specify the value of the HTTP response, then we will take a look at the specific content.
First look at the definition of official documents
(PHP 4, PHP 5, PHP 7)
header- Sending native HTTP headers
1 void Header (string $string [, bool $replace = true [, int $http _response_code]])
Parameter
This article mainly introduces ThinkPHP's method of accessing a module that does not exist to jump to the 404 page. if you need ThinkPHP, refer to ThinkPHP on the 404 page.
First, create a file EmptyAction. class. php in ACTION. The code is as follows:
To use the apache server, add ErrorDocument 404/404. html to the apache website configuration.
When using the iis server, you must set the 404 error page under iis/ASP.net in IIS.
Open the apache htt
Why is URLrewrite wrong?
RewriteEngine On
RewriteBase/forum
RewriteRule ^ (Index | List | Content | admin | Vote | Message | Favor). *) $ index. php/$1
Prompt
Not Found
The requested URL/forum/List-index-f-2.shtml was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
But I write
RewriteRule 1.php 2.php is correct and confusing
Reply to discus
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.