不在URL中添加问号就无法访问链接

Cant visit links without adding a question mark to the URL

本文关键字:访问 链接 URL 添加 不在      更新时间:2023-09-26

每次点击URL时,我都会得到一个404。那是因为找不到页面。但是当我在.domain后面添加一个问号时,页面就会被找到。当我把网站托管在子域文件夹中时,这不是问题所在。访问一个页面需要一个问号,我不想有这个问号。

请查看网址:http://www.ankehesselmann.nl/

我正在使用StaceyApp

这是我的.htaccess

RewriteEngine on
# Some hosts require a rewritebase rule, if so, uncomment the RewriteBase line below. If you are running from a subdirectory, your rewritebase should match the name of the path to where stacey is stored.
ie. if in a folder named 'stacey', RewriteBase /stacey
RewriteBase /stacey
ErrorDocument 404 /404.html
# Rewrite any calls to *.html, *.json, *.xml, *.atom, *.rss, *.rdf or *.txt if a folder matching * exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !public/
RewriteCond %{DOCUMENT_ROOT}/public/$1.$2 !-f
RewriteRule (.+)'.(html|json|xml|atom|rss|rdf|txt)$ $1/ [L]
#Add a trailing slash to directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !('.)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ([^/]+)$ $1/ [L]
# Rewrite any calls to /* or /app to the index.php file
RewriteCond %{REQUEST_URI} /app/$
RewriteRule ^app/ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php?$1 [L]
# Rewrite any file calls to the public directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.+)$ public/$1 [L]

我猜RewriteBase在.htaccess中被设置到了错误的文件夹虽然我无法解释为什么它能像你说的那样使用问号,但我会尝试正确设置重写库。

如果你有子文件夹,你必须放它(从域名到索引文件的路径)。例如:

网址:example.com/folder1/sub/

RewriteBase /folder1/sub/

如果你的网站没有子文件夹:

RewriteBase /

如果没有子文件夹,您可以尝试删除该行,但如果设置为/(斜线),则不会产生任何问题。