.htaccess中的RewriteRule不起作用

时间:2014-08-20 10:14:22

标签: apache .htaccess mod-rewrite

我是Apache的新手,我试图缩短网页的网址,来自

http://mysrvr:9191/my/long/path/to/app.php

http://mysrvr:9191/app.php 

我认为可以在.htaccess文件中使用 RewriteRule 来完成,但它根本不起作用,所以我尝试了一个非常简单的测试。 这个也不起作用。

我将谈论这个测试。

这是我的应用程序文件夹中的 .htaccess

DirectoryIndex robbie.html index4.html 
Options +FollowSymLinks
#Edited --- RewriteEngine On
RewriteEngine On
RewriteRule ^(.*)/index4.html$ $1/robbie.html

我也尝试了

RewriteRule ^(.*)/index4.html$ /$1/robbie.html

但是在介绍时

http://mysrvr:9191/my/long/path/to/index4.html 

其中没有两个选项重定向到

http://mysrvr:9191/my/long/path/to/robbie.html 
然而,

DirectoryIndex 按预期工作,所以我放弃了.htaccess被忽略的想法。

这让我觉得可能 mod_rewrite 尚未上传,但是:

> httpd.exe -t -D DUMP_MODULES
[Wed Aug 20 12:04:15 2014] [error] (OS 11004)The requested name is valid, but no data of the requested type was found.  : Could not resolve host name hserver.rob.igroup -- ignoring!
Loaded Modules:
 core_module (static)
 win32_module (static)
 mpm_winnt_module (static)
 http_module (static)
 so_module (static)
 actions_module (shared)
 alias_module (shared)
 asis_module (shared)
 auth_basic_module (shared)
 authn_default_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 dir_module (shared)
 env_module (shared)
 include_module (shared)
 isapi_module (shared)
 log_config_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 php5_module (shared)

有人请在这个问题上分享他们的想法吗?

0 个答案:

没有答案