GoDaddy .htaccess问题 - 简单修复

时间:2015-10-05 20:53:18

标签: php apache .htaccess mod-rewrite

我从codecanyon购买了一个脚本并安装了其他所有内容而没有麻烦但是问题是由于我认为是.htaccess问题我一直收到404错误。我在同一台服务器上有类似的脚本,它总是通过调整.htaccess来解决它。

有人会对目前无法正常工作的内容提出任何建议:

RewriteEngine on
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^news/(.*)/(.*)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php

所以我添加了这个

Options +FollowSymLinks -MultiViews -Indexes

现在我的.htaccess:文件看起来如下,但仍无效。

Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine on
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^news/(.*)/(.*)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php

我放弃了,正在寻求帮助。当我尝试去一个没有.htaccess重写的链接时,我的帖子出现了

例如这不起作用: http://rockwallhistoricsquare.com/news/20/stand-off-in-rockwall

然而,这确实有效:  http://www.rockwallhistoricsquare.com/news.php?id=20&slug=stand-off-in-rockwall

我做错了什么?非常感谢帮助,谢谢!

1 个答案:

答案 0 :(得分:0)

DirectoryIndex index.php<br>
AddDefaultCharset utf-8<br>
RewriteEngine on<br>
Options +FollowSymlinks -MultiViews -Indexes
RewriteRule ^category/(.*)/(.*)$ category.php?id=$1&slug=$2
RewriteRule ^source/(.*)/(.*)$ source.php?id=$1&slug=$2
RewriteRule ^news/(.*)/(.*)$ news.php?id=$1&slug=$2
RewriteRule ^page/(.*)/(.*)$ page.php?id=$1&slug=$2
RewriteRule ^search/(.*)$ search.php?q=$1
RewriteRule ^not-found$ notfound.php
RewriteRule ^rss.xml$ rss.php
RewriteRule ^sitemap-(.*).xml$ sitemap.php?id=$1
RewriteRule ^categories-sitemap.xml$ categories-sitemap.php

这很好用