English 中文(简体)
mod_rewrite - Add path to RE RequestST_FILENAME 变量
原标题:mod_rewrite - add path to REQUEST_FILENAME variable

我的守则是:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond application/public/%{REQUEST_FILENAME} -f 
RewriteRule (.*) application/public/$1 [L]

我要表达:

  • If file {REQUEST_FILENAME} doesn t exist AND if file application/public/%{REQUEST_FILENAME} exists do rewrite

实例:

  • /style.css = /application/public/style.css
  • /gfx/logo.png = /application/public/gfx/logo.png
  • /index.php = /index.php
  • /Welcome = /index.php?input=Welcome (it s working)

这一表述有什么适当的准则? 我认为,需要改变思路:

RewriteCond application/public/%{REQUEST_FILENAME} -f 

但是,我没有血腥的思维方式......

全面登录:

RewriteEngine on

RewriteRule style,(.+).css tmp/merged/css,$1 [L,QSA]
RewriteRule script,(.+).js tmp/merged/js,$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond application/public/%{REQUEST_FILENAME} -f 
RewriteRule (.*) application/public/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule (.*) index.php?input=$1 [L,QSA]

(为我的办公室服务)

最佳回答

i) 找到小型工作,但并不奇怪的解决办法:

RewriteEngine on

# Access to files in ./application/public
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule (.*) application/public/$1 [DPI]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule application/public/(.*) $1 [DPI]

# Main rewrite
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule (.*) index.php?input=$1 [L,QSA,DPI] 
问题回答

暂无回答




相关问题
Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

Multiple Sites with common files

I have developed over 50 sites that all use the exact same files other than CSS and IMAGES, I currently duplicate the files each time I create a new site and upload different css and images. What ...

http server validation

I finish a litle http server, writing from scratch. I would like to be sure that my imlementation is conforme to the HTTP specifications. W3C give us tools for HTML/XML conformance, but i see nothing ...

热门标签