目前,我遇到了最奇怪的问题!:(每当我单击它时,它的大小就会加倍,我认为是因为.htaccess文件的缘故)。首先,让我将我的.htaccess文件发布给您:
Options +FollowSymLinks
RewriteEngine on
# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^[\w.'@\\\/-]+/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/?$ posts.php?sortby=$1&sorttime=$2 [NC,L]
RewriteRule ^[\w.'@\\\/-]+/([a-zA-Z0-9]+)/?$ posts.php?sortby=$1 [NC,L]
RewriteRule ^[\w.'@\\\/-]+$ posts.php [NC,L]
<Files .htaccess>
order allow,deny
deny from all
</Files>现在,在我进一步解释之前,我想说我使用的是本地主机(不是问题,其他页面可以正常工作)。我还想告诉您.htaccess和posts.php的文件路径。
localhost/postin'/categories/{category}/{var1-optional}/{var2-optional}
现在{ can }部分可以更改,这就是为什么它是[\w.'@\\\/-]+。这是连接到posts.php的部分。好了,现在来看看眼前的问题!让我们说我在URL上:
http://localhost/postin'/categories/coding/popular/today
^category ^var1 ^var2从那一页,我点击一个按钮,把我带到
http://localhost/postin'/categories/coding/views/today那个网址实际上会带我去:
http://localhost/postin'/categories/coding/popular/localhost/postin'/categories/coding/views/today,所以我的问题是为什么当我点击链接时,链接的大小会加倍?
我有另一个.htaccess在我的网站上的另一个文件夹,并在那里的链接工作非常好!
发布于 2015-04-16 22:10:24
对“任择议定书”问题的解释:
他的.htaccess没有什么问题,只是他的href(或链接)的构建方式。
这是完整的解释
没有协议(// or http://)的链接,以及没有相对路径(/)的链接,只需将链接的路径添加到当前URI。因此,从www.example.com到href="foo.com"的链接将引导我们到www.example.com/foo.com,链接应该是href="http://foo.com";真正的重定向。您可以看到,从您的上一个URL,您可以看到,新的URL被附加到原点的末尾
https://stackoverflow.com/questions/29685866
复制相似问题