我目前正试图在我的Apache服务器上安装Anchor CMS。无法让Anchor CMS重写工作
我已成功将其部署到服务器。也就是说,当我去www.domain.com时,我接受默认主题的首页和测试帖子:)
但是,如果我尝试点击帖子,或者转到管理区域,我收到如下错误:
未找到:在此服务器上未找到请求的URL/posts/hello-world。
但是,如果我按照(在这种情况下)链接后使用直接链接,如:
www.domain.com/index.php/posts/hello-world
它工作得很好。所以,重写似乎是一个问题。
我发现了另一个问题#2酷似矿井,位于here
不幸的是,我做了同样的步骤,并没有什么作品。只是为了回顾一下,这是我的虚拟主机的外观:
<VirtualHost *:80>
ServerName www.domain.com
ServerAlias domain.com
DocumentRoot /var/www/domain.com/public_html
<Directory /var/www/domain.com/public_html>
AllowOverride All
Require all granted
</Dictory>
</VirtualHost>
这是我的锚CMS config.app文件的外观:
return array(
'url' => '/',
'index' => '',
...(rest of the data here)...
由于documentation美国在这个默认使用空指数案件。
我的.htaccess目前看起来是这样的:
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
它位于文档根目录“的public_html”
可悲的是,即使配置了这些事情,我仍然得到“未找到”错误。我真的不知道从哪里这里:(
编辑去
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule^http://google.com [R,L]
RewriteBase/
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
我试图把在一般重写.htaccess文件,而且好像它没有被执行: 。
你能检查一下htaccess是否真的被处理? – hjpotter92
嘿@ hjpotter92! :)对于这个愚蠢的问题感到抱歉,但我对通常的Web开发和服务器使用情况颇为陌生。我如何检查是否正在处理htaccess? :) – CodingBeagle
进行一般重写,将您重定向到其他页面:'RewriteRule^http://google.com [R,L]'。它应该超过所有其他规则,就在'RewriteEngine On'指令后面。 – hjpotter92