我正在使用Section标头(EN / ES是Section标头)来做多语言页面,但是我在使用URL时遇到问题-返回404。
我的页面结构:
- EN (Section header)
- - home (content)
- - ... (content)
- - contact (content)
- ES (Section header)
- - lorem ipsum (content)
URL example.com/es/lorem-ipsum/
返回404(我想要这个URL)。
网址example.com/lorem-ipsum/
有效,但对我来说这是无效的网址格式
我的.htaccess文件
<IfModule rewrite_module>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$
RewriteRule ^(.+[^/])$ /$1/ [R=302,L]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) https://example.com/$1 [R=302,QSA,L]
RewriteCond %{QUERY_STRING} http\: [OR]
RewriteCond %{QUERY_STRING} \[ [OR]
RewriteCond %{QUERY_STRING} \] [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# blog/ID/61/alias/ -> blog/ID-alias/
RewriteRule blog\/(\d+)-(.*)\/ blog/$1/61/$2/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
RedirectMatch 403 ^/.*\.htaccess$
RedirectMatch 403 ^/.*\.log$
RedirectMatch 403 ^/.*\.ini$
RedirectMatch 403 ^/.*config\.php$
RedirectMatch 403 ^.*/doc/.*$
RedirectMatch 403 ^.*/lib/.*\.php$
RedirectMatch 403 ^.*/tmp/.*\.php$
#RedirectMatch 403 ^.*/modules/.*\.php$
#RedirectMatch 403 ^.*/uploads/.*\.php$
RedirectMatch 403 ^.*/assets/.*\.php$
RedirectMatch 403 ^.*/assets/.*\.tpl$
<IfModule mod_headers.c>
# Disable Last-Modified for performance
Header unset Last-Modified
# Disable ETags
Header unset ETag
FileEtag None
# For Security
Header set X-Frame-Options "SAMEORIGIN"
</IfModule>
<IfModule deflate_module>
AddOutputFilterByType DEFLATE text/html text/css text/plain text/html text/xml image/gif image/jpeg image/png image/ico text/javascript application/x-javascript application/javascript application/json application/pdf
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# Set expires tags on various file types... so that the browser won't attempt to reload them.
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/ico "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType video/x-flv "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
<IfModule mod_headers.c>
# Setting cache control to public allows proxy servers to cache the items too.
Header set Cache-Control "public"
</IfModule>
</IfModule>
我在.htaccess(非常差的知识)和应用程序中尝试了很多东西,但没有结果。
感谢您的咨询。