[英].htaccess mod_rewrite error
Here is the htaccess in the public_html: 这是public_html中的htaccess:
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
Options -Multiviews
Options -Indexes
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{REQUEST_URI} !api\\dispatch\.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/.* api/dispatch.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Here is the code for the htaccess in public_html/sites/ 这是public_html / sites /中htaccess的代码
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks -MultiViews
Options +SymLinksIfOwnerMatch -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^/.]+)\.webznap\.com$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC]
RewriteCond %{REQUEST_URI} !^/sites [NC]
RewriteRule ^ http://webznap.com/sites/%1/ [L]
Here is the htaccess for public_html/sites/luis/ 这是public_html / sites / luis /的htaccess
RewriteEngine On
ErrorDocument 400 /page/error
ErrorDocument 401 /page/error
ErrorDocument 403 /page/error
ErrorDocument 404 /page/error
ErrorDocument 500 /page/error
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
There you go thank you for all your help prix i really appreciate it ! 谢谢您的帮助,我非常感谢!
Give this a try: 试试看:
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options -Multiviews -Indexes +SymLinksIfOwnerMatch
RewriteEngine on
ErrorDocument 400 /page/error
ErrorDocument 401 /page/error
ErrorDocument 403 /page/error
ErrorDocument 404 /page/error
ErrorDocument 500 /page/error
RewriteCond %{HTTP_HOST} ^([^/.]+)\.webznap\.com$ [NC]
RewriteCond %1 !^(www|ftp|mail)$ [NC]
RewriteCond %{REQUEST_URI} !^/sites [NC]
RewriteRule ^ /sites/%1%{REQUEST_URI} [L]
RewriteCond %{REQUEST_URI} !api\\dispatch\.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/.* api/dispatch.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
SIDE NOTE: public_html/sites/.htaccess
and public_html/sites/dynamic_subdoamin/.htaccess
should be removed! 旁注:应删除public_html/sites/.htaccess
和public_html/sites/dynamic_subdoamin/.htaccess
!
And make sure that: 并确保:
anything_you_try.domain.com
Exists on: 存在于:
anything_your_try.domain.com/sites/anything_your_try
Or it will fail. 否则它将失败。
What it does? 它能做什么?
The first line catch the sub-domain name if any: 第一行捕获子域名(如果有):
RewriteCond %{HTTP_HOST} ^([^/.]+)\.example\.com$ [NC]
This line makes sure the sub-domain is not www, ftp or mail: 此行确保子域不是www,ftp或mail:
RewriteCond %1 !^(www|ftp|mail)$ [NC]
This line verify is the URL path does not start with /sites
: 此行验证URL路径不是以/sites
开头:
RewriteCond %{REQUEST_URI} !^/sites [NC]
This line will internally redirect whatever the URL is: 无论URL是什么,此行都将在内部重定向:
RewriteRule ^ /sites/%1%{REQUEST_URI} [L]
So if the URL was for example: 因此,例如,URL:
http://luis.domain.com/hello
It will show the content of: 它将显示以下内容:
http://luis.domain.com/sites/luis/hello
Without changing the URL. 无需更改URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.