这是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
以下是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]
这是public_html / sites / luis /
的htaccessRewriteEngine 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
你去感谢你所有的帮助prix我真的很感激!
答案 0 :(得分:3)
尝试一下:
# 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注意:应删除public_html/sites/.htaccess
和public_html/sites/dynamic_subdoamin/.htaccess
!
并确保:
anything_you_try.domain.com
存在于:
anything_your_try.domain.com/sites/anything_your_try
或者它会失败。
它做什么?
第一行捕获子域名(如果有):
RewriteCond %{HTTP_HOST} ^([^/.]+)\.example\.com$ [NC]
此行确保子域不是www,ftp或mail:
RewriteCond %1 !^(www|ftp|mail)$ [NC]
此行验证是网址路径不以/sites
开头:
RewriteCond %{REQUEST_URI} !^/sites [NC]
此行将在内部重定向任何URL:
RewriteRule ^ /sites/%1%{REQUEST_URI} [L]
因此,如果URL是例如:
http://luis.domain.com/hello
它将显示以下内容:
http://luis.domain.com/sites/luis/hello
不更改网址。