htacces规则-挑战

时间:2019-08-06 00:43:44

标签: .htaccess

对于给定的URL,我已经很好地处理了路由/代码,显然URL显示绝对正确,但是在标题中显示403而不是200。

这是因为在域之后我还有另一个(点)。

https://example1.com/availableon/example2.com

# Turn on URL rewriting
RewriteEngine On

RewriteBase /

#Redirect to https
Rewritecond %{HTTP_HOST} ^www\.example1\.com$ [NC]
Rewriterule ^ http://example1.com%{REQUEST_URI} [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^example1\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example1.com/$1 [R=301,NC,L]

# Protect application and system files from being viewed when the index.php is missing
RewriteCond $1 ^(application|system|private|logs)

# Rewrite to index.php/access_denied/URL
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

# Allow these directories and files to be displayed directly:
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|public|assets|css|js|images)

# No rewriting
RewriteRule ^(.*)$ - [PT,L]

# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]

0 个答案:

没有答案