2012-04-12 83 views
0

背景问题与zues Web服务器

我一直在一个简单的内容管理系统,为客户,让他们管理新闻报导,他们的移动应用程序URL重写。现在系统写在运行LAMP的本地开发服务器上,PHP版本为5.

现在我的客户端正在使用一个完全不同的平台(Zues网络服务器),它们的主机提供商提供了它们(我说完全不同,因为我有之前没有系统的先前知识,他们可能没有那么大的不同,但对我来说就是这样)在我第一次尝试将系统迁移到他们的服务器之后,我遇到了一些问题,第一个问题是他们在哪里运行php版本4,我设法说服他们升级到他们现在已经完成的php 5。

但我遇到的另一个问题是Zues处理脚本的方式,在Apache中有一个.htaccess文件,可以让你做很多事情,Zues似乎更喜欢使用单独的脚本文件来处理诸如url重写。

-

问题

所以我的问题是,我不能确定如何正确地改写了一套的.htaccess URL重写规则,妥善Zues工作,下面的一些教程(这是很难为zues找到体面的深度教程,或者至少它是为我)我有一个基本的rewrite.script适用于一些页面,但不是全部。

在我的应用程序中,有两个主要部分不工作,除了mysql查询和表单中的几个不同元素外,两个部分几乎都是相同的,所以我只谈一个新闻部分。

用户可以点击新闻部分,然后检查用户是否指定了他们想要查看的页码。如果他们没有,它会通过将它们重定向到/news/1/来为他们设置一个,当用户查看新闻部分,发布和未发布的新闻时,还有2个部分,当用户点击他们想要访问该URL的区域将被设置为/news/publishednews/unpublished页面便会将该值设置为一个会话变量和页面重置为/news/1/

,这似乎是在我的问题是,我想它有什么做的正则表达式的页面因为无论我在新闻中转到哪个页面,它将页面url设置为news/1/,然后Firefox将返回错误:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete. 

所以我的主要猜测是,而不是重定向说/news/create/news_create.php它重定向到news_view.php页面,但即使这种情况下,我仍然不明白为什么在Apache服务器上它加载罚款和Zues它返回那个错误。

有谁知道我做错了什么,我需要改变以解决它吗?

-

代码

原。htaccess的

#Enable URL rewriting. 
RewriteEngine on 
RewriteRule ^dashboard/?$ dashboard.php [L] 

RewriteRule ^account/login/?$ account_login.php [L] 
RewriteRule ^account/logout/?$ account_logout.php [L] 
RewriteRule ^account/settings/?$ account_settings.php [L] 
RewriteRule ^account/retrieve/?$ account_retrieve.php [L] 
RewriteRule ^account/retrieve/([A-Z0-9_]+)/?$ account_retrieve.php?recovery_code=$1 [L] 

RewriteRule ^news/?$ news_view.php [L] 
RewriteRule ^news/create/?$ news_create.php [L] 
RewriteRule ^news/modify/?$ news_modify.php [L] 
RewriteRule ^news/modify/([0-9]+)/?$ news_modify.php?id=$1 [L] 
RewriteRule ^news/delete/([0-9]+)/?$ news_view.php?delete=$1 [L] 
RewriteRule ^news/([a-z]+)/?$ news_view.php?view=$1 [L] 
RewriteRule ^news/([0-9]+)/?$ news_view.php?page=$1 [L] 

RewriteRule ^information/?$ information_view.php [L] 
RewriteRule ^information/create/?$ information_create.php [L] 
RewriteRule ^information/categories/?$ information_categories.php [L] 
RewriteRule ^information/modify/?$ information_modify.php [L] 
RewriteRule ^information/modify/([0-9]+)/?$ information_modify.php?id=$1 [L] 
RewriteRule ^information/delete/([0-9]+)/?$ information_view.php?delete=$1 [L] 
RewriteRule ^information/([a-z]+)/?$ information_view.php?view=$1 [L] 
RewriteRule ^information/([0-9]+)/?$ information_view.php?page=$1 [L] 

RewriteRule ^json/get/([a-z]+)/?$ json_call.php?get_article_type=$1 [L] 

新rewrite.script

match URL into $ with ^/dashboard/ 
if matched 
    set URL=/dashboard.php 
    goto END 
endif 





match URL into $ with ^/account/login/ 
if matched 
    set URL=/account_login.php 
    goto END 
endif 

match URL into $ with ^/account/logout/ 
if matched 
    set URL=/account_logout.php 
    goto END 
endif 

match URL into $ with ^/account/settings/ 
if matched 
    set URL=/account_settings.php 
    goto END 
endif 

match URL into $ with ^/account/retrieve/ 
if matched 
    set URL=/account_retrieve.php 
    goto END 
endif 

match URL into $ with ^/account/retrieve/([A-Z0-9_]+)/ 
if matched 
    set URL=/account_retrieve.php?recovery_code=$1 
    goto END 
endif 





match URL into $ with ^/news/ 
if matched 
    set URL=/news_view.php 
    goto END 
endif 

match URL into $ with ^/news/create/ 
if matched 
    set URL=/news_create.php 
    goto END 
endif 

match URL into $ with ^/news/modify/ 
if matched 
    set URL=/news_modify.php 
    goto END 
endif 

match URL into $ with ^/news/modify/([0-9]+)/ 
if matched 
    set URL=/news_modify.php?id=$1 
    goto END 
endif 

match URL into $ with ^/news/delete/([0-9]+)/ 
if matched 
    set URL=/news_view.php?delete=$1 
    goto END 
endif 

match URL into $ with ^/news/([a-z]+)/ 
if matched 
    set URL=/news_view.php?view=$1 
    goto END 
endif 

match URL into $ with ^/news/([0-9]+)/ 
if matched 
    set URL=/news_view.php?page=$1 
    goto END 
endif 





match URL into $ with ^/information/ 
if matched 
    set URL=/information_view.php 
    goto END 
endif 

match URL into $ with ^/information/create/ 
if matched 
    set URL=/information_create.php 
    goto END 
endif 

match URL into $ with ^/information/categories/ 
if matched 
    set URL=/information_categories.php 
    goto END 
endif 

match URL into $ with ^/information/modify/ 
if matched 
    set URL=/information_modify.php 
    goto END 
endif 

match URL into $ with ^/information/modify/([0-9]+)/ 
if matched 
    set URL=/information_modify.php?id=$1 
    goto END 
endif 

match URL into $ with ^/information/delete/([0-9]+)/ 
if matched 
    set URL=/information_view.php?delete=$1 
    goto END 
endif 

match URL into $ with ^/information/([a-z]+)/ 
if matched 
    set URL=/information_view.php?view=$1 
    goto END 
endif 

match URL into $ with ^/information/([0-9]+)/ 
if matched 
    set URL=/information_view.php?page=$1 
    goto END 
endif 





match URL into $ with ^/json/get/([a-z]+)/ 
if matched 
    set URL=/json_call.php?get_article_type=$1 
    goto END 
endif 

*相关的​​代码从news_view.php *

<?php 

    //Require the configuration file. 
    require('_configuration.php'); 

    //Establish a database connection. 
    $connection->establish(); 

    //Check that the user is logged in. 
    $account->check_login_state(); 

    //Check what view is selected and assign a view. 
    if($_GET['view']) { 
     if($_GET['view'] == 'pending') { 
      $_SESSION[$G_instance_name]['view']['news'] = 'pending'; 
      header('location: /news/'); 
      die; 
     } else { 
      $_SESSION[$G_instance_name]['view']['news'] = 'published'; 
      header('location: /news/'); 
      die; 
     } 
    } else if(!isset($_SESSION[$G_instance_name]['view']['news']) or empty($_SESSION[$G_instance_name]['view']['news'])) { 
     $_SESSION[$G_instance_name]['view']['news'] = 'published'; 
     header('location: /news/'); 
     die; 
    } 

    //Check if the modify article is still set and unset it. 
    if(!empty($_SESSION[$G_instance_name]['modify']['news'])) { 
     unset($_SESSION[$G_instance_name]['modify']['news']); 
    } 

    //Check if the user has attempted to delete an article. 
    if(isset($_GET['delete'])) { 
     $operation->article->delete($_GET['delete']); 
    } 

    //Check if the user is on a page, if note set the page to 1 as default. 
    if(!isset($_GET['page']) or empty($_GET['page'])) { 
     header('location: /news/1/'); 
     die; 
    } 

    //Get all news articles. 
    $news_article = $operation->pagition->gather_article_data('news'); 

?> 

任何帮助是极大的赞赏。

回答

0

想通了,我在每场比赛结束时都错过了$。的

match URL into $ with ^/account/login/ 

应该被

match URL into $ with ^/account/login/$