In my root .htaccess I have
在我的根.htaccess我有
Options +FollowSymlinks
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/dashboard/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^dashboard.domain.com
RewriteRule ^(.*)$ /dashboard/$1 [NC,L,NS]
In the dashboard folder's .htaccess I have..
在仪表板文件夹的.htaccess我有..
RewriteRule ^go/([^/.]+)/?$ index.php?flag=$1 [L]
When I go to dashboard.domain.com/login it throws up an error. When I go to dashboard.domain.com/go/a it works.
当我访问dashboard.domain.com/login时,它会引发错误。当我去dashboard.domain.com/go/a时,它的工作原理。
When I # out the dashboard rewrite rule the opposite occurs, /login works, but then /go/$1 doesn't. What am I missing to make the /go rewrite only apply when /go is detected?
当我#out the dashboard rewrite rule相反时,/ login工作,但是/ go / $ 1则没有。只有在检测到/ go时,我才会错过什么才能进行/ go重写?
EDIT (rest of root htaccess)
编辑(其他根htaccess)
AddHandler application/x-httpd-php54 .php
Options +FollowSymlinks
Options -Indexes
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} !^/rocket/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^launch.domain.com
RewriteRule ^(.*)$ /rocket/$1 [NC,L,NS]
RewriteCond %{REQUEST_URI} !^/dashboard/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^dashboard.domain.com
RewriteRule ^(.*)$ /dashboard/$1 [NC,L,NS]
RewriteCond %{REQUEST_URI} !^/img/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^img.domain.com
RewriteRule ^(.*)$ /img/$1 [NC,L,NS]
#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [NC]
#RewriteCond %{HTTP_HOST} !launch.domain.com [NC]
#RewriteRule ^(.*)$ https://launch.domain.com/$1 [R=301,L,QSA]
Redirect 301 /sneakpeek /
RewriteRule ^error/([^/]+) error/failure.php?code=$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
<FilesMatch "\.(ttf|otf|eot|woff|jpg|png|jpeg|gif|js|json|html|css|php)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
ErrorDocument 400 /error/400
ErrorDocument 401 /error/401
ErrorDocument 403 /error/403
ErrorDocument 404 /error/404
ErrorDocument 500 /error/500
1 个解决方案
#1
2
Rules below your dashboard rule might be affecting your rule and changing %{REQUEST_URI}
variable. You can use THE_REQUEST
variable and retest it after clearing your browser cache:
仪表板规则下面的规则可能会影响您的规则并更改%{REQUEST_URI}变量。您可以使用THE_REQUEST变量并在清除浏览器缓存后重新测试它:
RewriteCond %{THE_REQUEST} !/(dashboard|error)/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} =dashboard.domain.com
RewriteRule ^(.*)$ dashboard/$1 [NC,L]
#1
2
Rules below your dashboard rule might be affecting your rule and changing %{REQUEST_URI}
variable. You can use THE_REQUEST
variable and retest it after clearing your browser cache:
仪表板规则下面的规则可能会影响您的规则并更改%{REQUEST_URI}变量。您可以使用THE_REQUEST变量并在清除浏览器缓存后重新测试它:
RewriteCond %{THE_REQUEST} !/(dashboard|error)/
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} =dashboard.domain.com
RewriteRule ^(.*)$ dashboard/$1 [NC,L]