.htaccess 静态URL查询字符串
我试图使用htaccess将example.com/data重写为example.com/index.php?section=data。我用的是Statamic,这似乎让事情变得更复杂了。当使用下面的htaccess时,我得到了404,我做错了什么 如果我将“RewriteRule^data index.php?section=data”更改为“RewriteRule^data”,它可以正常工作,但似乎会触发重定向,并且url会更改为“”,我希望避免这种情况.htaccess 静态URL查询字符串,.htaccess,statamic,.htaccess,Statamic,我试图使用htaccess将example.com/data重写为example.com/index.php?section=data。我用的是Statamic,这似乎让事情变得更复杂了。当使用下面的htaccess时,我得到了404,我做错了什么 如果我将“RewriteRule^data index.php?section=data”更改为“RewriteRule^data”,它可以正常工作,但似乎会触发重定向,并且url会更改为“”,我希望避免这种情况 # Turn on the Rew
# Turn on the Rewrite Engine
RewriteEngine On
# ------------------------------------------------------------------------------
# Dynamic RewriteBase
# ------------------------------------------------------------------------- -----
# For most servers, this will be able to dynamically find your site's root,
# but if it doesn't for you, comment out these next two lines...
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
# ...and uncomment out the following line, then set as you need to
#RewriteBase /
# ------------------------------------------------------------------------------
# Protect System Files
# ------------------------------------------------------------------------------
RewriteRule ^_app - [F,L]
RewriteRule ^_config - [F,L]
RewriteRule ^_cache - [F,L]
RewriteRule ^_content - [F,L]
RewriteRule ^_logs - [F,L]
RewriteRule ^_storage - [F,L]
RewriteRule ^admin/themes/[^/]*/(?:layouts|templates) - [F,L]
RewriteRule ^.*?\.yml$ - [F,L]
RewriteRule ^.*?\.yaml$ - [F,L]
RewriteRule ^.*/?\.git+ - [F,L]
# This will prevent all .html files from being accessed.
# You may want to remove this line if you want to serve
# static files outside of Statamic
#RewriteRule ^(.*)?\.html$ - [F,L]
# ------------------------------------------------------------------------------
# Remove Trailing Slashes from URL
# ------------------------------------------------------------------------- -----
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
# ------------------------------------------------------------------------------
# Remove the Index File
# ------------------------------------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteRule ^data index.php?section=data