0

这就是我想要实现的目标:我已经编写了自己的小 CMS,并希望它可以处理不包含“index.php5”的链接,例如 www.website.com/blue 而不是 www.website.com/index.php5 /蓝色的。链接存储在数据库中。现在我想弄清楚我必须做什么才能使用这些链接。尝试使用 index.php5 包含的作品,但如果我设置我的 CMS 以创建没有 index.php5 的链接,我会收到 500 错误。

这是打开 index.php5 时我的 .htaccess 的外观:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
DirectoryIndex index.php5
ErrorDocument 404 http://www.website.com/index.php5/error404

要使用不包含 index.php5 的链接,我尝试将其更改为此,但最终出现 500 错误。

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
DirectoryIndex index.php5
ErrorDocument 404 http://www.website.com/error404
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php5?/$1

我也试图在这里找到答案,但显然我还没有弄清楚如何将 .htaccess 更改为适合我需要的东西......

4

1 回答 1

0

试试这个:

    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php5/$1 [L]
于 2013-08-14T08:59:52.590 回答