Php Htaccess,如果文件夹存在,则重定向
如果文件夹安装存在,我将尝试重定向用户,但到目前为止我运气不佳 下面是我的htaccess文件Php Htaccess,如果文件夹存在,则重定向,php,regex,.htaccess,codeigniter,mod-rewrite,Php,Regex,.htaccess,Codeigniter,Mod Rewrite,如果文件夹安装存在,我将尝试重定向用户,但到目前为止我运气不佳 下面是我的htaccess文件 RewriteEngine On RewriteBase /enc/project/ # If the setup directory exists in the document root... RewriteCond %{DOCUMENT_ROOT}/install -d # ...and you're not in isntall.. RewriteCond %{REQUEST_URI} !(i
RewriteEngine On
RewriteBase /enc/project/
# If the setup directory exists in the document root...
RewriteCond %{DOCUMENT_ROOT}/install -d
# ...and you're not in isntall..
RewriteCond %{REQUEST_URI} !(install) [NC]
# ...redirect to setup - with a 302 (temporary redirect) to make sure the browser won't cache the redirect.
RewriteRule ^(.*) /install [L,redirect=302]
# ...rest of htaccess for codeigniter
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
codeigniter项目位于我的服务器的/enc/project/
中,这就是重写库的原因
Project Structure is
htdocs/enc/project/
|-- application/
| |-- project
|
|-- system/
| |-- project
|
|-- install/
| |-- test/
| | |-- test_main.php
| |
| |-- index.php
|
|-- htaccess
这是一种有效的写作方法:
RewriteEngine On
RewriteBase /enc/project/
# If the setup directory exists in the document root...
RewriteCond %{DOCUMENT_ROOT}/enc/project/install -d
# ...and you're not in isntall..
RewriteCond %{REQUEST_URI} !(install) [NC]
# ...redirect to setup - with a 302 (temporary redirect) to make sure the browser won't cache the redirect.
RewriteRule ^(.*) /enc/project/install/ [L,redirect=302]
# ...rest of htaccess for codeigniter
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
试试这些规则
RewriteEngine On
RewriteBase /enc/project/
# If the setup directory exists in the document root...
RewriteCond %{DOCUMENT_ROOT}/enc/project/install -d
# ...and you're not in isntall..
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ...redirect to setup - with a 302 (temporary redirect) to make sure the browser won't cache the redirect.
RewriteRule !^install/ install/ [L,NC,R=302]
# ...rest of htaccess for codeigniter
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
localhost/enc/project
我用我的项目结构编辑了这个问题,我现在就试试,让你知道。Thanksys的问题是这个问题,尽管我得到了一个空白页面,并将我试图加载的每个css请求或文件重定向到安装文件夹。是的问题是这个问题,尽管我得到了一个空白页面,并将我试图加载的每个css
请求或文件重定向到安装文件夹