【问题标题】:.htaccess url to post by slug.htaccess url 由 slug 发布
【发布时间】:2018-07-11 17:01:14
【问题描述】:

我的博客有帖子。当我单击阅读更多按钮时,我想重定向并显示选定的帖子。想要的网址是http://www.solutions.com/blog/blog-post/slug。

在 .htaccess 我有这个:

RewriteEngine on RewriteCond %{HTTP_HOST} ^solutions\.com 
RewriteRule ^(.*)$ http://www.solutions.com/$1 [R=permanent,L]
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}
!-f RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ 
$1.html [L]

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond
%{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php

RewriteBase / RewriteRule ^blog/blog-post/(.+)
blog/blog-post.php?slug=$1

但我得到一个错误:

加载资源失败:服务器响应状态为 500 (内部服务器错误)

我该如何解决这个问题?

【问题讨论】:

标签: php jquery .htaccess


【解决方案1】:

最后一行中的加号会导致问题吗?

所以而不是:

RewriteRule ^blog/blog-post/(.+) blog/blog-post.php?slug=$1

试试

RewriteRule ^blog/blog-post/(.*) blog/blog-post.php?slug=$1

【讨论】:

    猜你喜欢
    • 2014-06-28
    • 1970-01-01
    • 2015-06-03
    • 2015-05-21
    • 2015-07-28
    • 2013-09-04
    • 2012-06-12
    • 2023-03-28
    • 2014-02-09
    相关资源
    最近更新 更多