确认这些 301 重定向在我的 htaccess 文件中正确设置

确认这些 301 重定向在我的 htaccess 文件中正确设置

我的根目录中有英文页面,子目录文件夹中有阿拉伯文页面,但规则是 https://htaccess.madewithlove.com/

RewriteCond %{HTTP_HOST} ^arianamedicaretour\.com$ [NC]

但这一条件并未得到满足。

8

RewriteRule ^ https://www.arianamedicaretour.com%{REQUEST_URI} [L,R=301,NE]

这条规则没有得到满足。

9

RewriteCond %{HTTPS} off

但这一条件并未得到满足。

10

RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

这条规则没有得到满足。

11

RewriteCond %{HTTP_HOST} ^arianamedicaretour\.com$ [NC]

但这一条件并未得到满足。

12

RewriteCond %{REQUEST_URI} ^/ar/(.*)$ [NC]

但这一条件并未得到满足。

十三

RewriteRule ^ https://www.arianamedicaretour.com/ar/%1 [L,R=301,NE]

该规则未得到满足。这就是 ar 页面未重定向的原因。请确认我的 htaccess 文件中子目录 301 重定向的正确条件是什么。

RewriteEngine On

# Pass through the Authorization header to the environment.
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Set the base URL for per-directory rewrites.
RewriteBase /


# If the requested resource does not correspond to a real file or directory,
# rewrite requests to /index.html (used commonly in single-page applications).
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

# Redirect non-www to www with HTTPS for the entire site, including the "ar" subdirectory.
RewriteCond %{HTTP_HOST} ^arianamedicaretour\.com$ [NC]
RewriteRule ^ https://www.arianamedicaretour.com%{REQUEST_URI} [L,R=301,NE]

# Ensure all requests are served over HTTPS.
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

# Specific rule for the "ar" subdirectory to ensure it's also affected by the redirect
RewriteCond %{HTTP_HOST} ^arianamedicaretour\.com$ [NC]
RewriteCond %{REQUEST_URI} ^/ar/(.*)$ [NC]
RewriteRule ^ https://www.arianamedicaretour.com/ar/%1 [L,R=301,NE]

相关内容