简体   繁体   English

不能访问链接而无需在URL上添加问号

[英]Cant visit links without adding a question mark to the URL

Every time when I click on an URL I get a 404. That's because the page can't be found. 每次单击URL时,都会得到404。这是因为找不到该页面。 But when I add a question mark right after the .domain the page is found. 但是,当我在.domain之后添加问号时,发现该页面。 This was not the problem when I had the website hosted in a subdomain folder. 当网站托管在子域文件夹中时,这不是问题。 A question mark is required to visit a page and I don't want to have the question mark. 要访问页面,必须带问号,但我不想有问号。

Please see the url: http://www.ankehesselmann.nl/ 请参阅网址: http//www.ankehesselmann.nl/

I'm using StaceyApp 我正在使用StaceyApp

This is my .htaccess 这是我的.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] 

I'm guessing the RewriteBase is set to the wrong folder in your .htaccess Though I cannot explain why it works with the question mark as you said, I would try setting the RewriteBase correctly. 我猜您的.htaccess中的RewriteBase设置为错误的文件夹,尽管我无法像您所说的那样解释为什么它可以与问号一起使用,但我会尝试正确设置RewriteBase。

You have to put the sub-folder (path from domain name until your index-file) if you have any. 如果有的话,必须放置子文件夹(从域名到索引文件的路径)。 Eg: 例如:

Website located at: example.com/folder1/sub/ 网站位于:example.com/folder1/sub/

RewriteBase /folder1/sub/

If your website doesn't have a sub-folder: 如果您的网站没有子文件夹:

RewriteBase /

You may try removing the line if you haven't got a sub-folder, but it should not make any problems if set to / (slash). 如果没有子文件夹,则可以尝试删除该行,但是如果将其设置为/(斜杠),则不会出现任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM