小编dav*_*t-g的帖子

如何使用别名重写规则?

如果这太长,我会提前道歉.我认为更多的细节比更少的更好,并希望我不是可怕的漫无边际:-)

我在我的笔记本电脑上使用WAMP用于本地开发,我有各种c:/wamp/alias/*文件,每个文件都指向一个项目工作目录.我有一些很棒的mod_rewrite帮助并得到了

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*\/)?ih(\/.*)?$ $1index.php$2 [L,QSA]
Run Code Online (Sandbox Code Playgroud)

合作,改变localhost/.../ih/sub/dirlocalhost/.../index.php/sub/dir针对既搜索引擎友好的和短网址.[我还没有在这样做的督促,但我怀疑这会很好的工作.然而,把一切在一起,我不得不改变我的文档根c:/wamp/www/c:/,这我真的不想只是做我的Apache被黑客攻击,否则因为它是一个kludge.

我的测试别名文件看起来像

Alias /testme "c:/var/tmp/wamp-testme/"
<Directory "c:/var/tmp/wamp-testme/">
  Options Indexes FollowSymLinks MultiViews
  AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*\/)?ih(\/.*)?$ $1index.php$2 [L,QSA]
</Directory>
Run Code Online (Sandbox Code Playgroud)

我尝试加载时得到的错误http://localhost/testme/rewrites/ih/sub/path

[Thu Jun 30 06:46:13 2011] [error] [client 127.0.0.1]
  File does not exist: C:/wamp/www/var
Run Code Online (Sandbox Code Playgroud)

与匹配

Not Found
The requested URL …
Run Code Online (Sandbox Code Playgroud)

apache url mod-rewrite alias rewrite

5
推荐指数
1
解决办法
4089
查看次数

标签 统计

alias ×1

apache ×1

mod-rewrite ×1

rewrite ×1

url ×1