Articles of .htaccess

.htaccess无法在Cent Os上运行6.4

我已经安装了Cent Os 6.4 -Final Version,并为PHP Web开发设置了环境。 我的应用程序使用.htaccess的URL重写&否认直接访问文件。 我的configuration文件httpd – /etc/httpd/conf/httpd.conf如下, <Directory "/var/www/html"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* — "Options All" # doesn't give it to you. # # […]

Apache SetEnvIf无法匹配Request_Uri

简单的条件,永远不会匹配和设置variables: SetEnvIf Request_URI "^/path/to/something*" access_granted 使用PHP检查URI是给出正确的string,但是从不设置variables。 echo getenv('Request_URI'); –> /path/to/something echo getenv('access_granted'); –> <<empty>> 这样简单,但仍然总是失败。 更新:有趣的一点是,我可以通过string来实现access_granted = 1: SetEnvIf Request_URI "^/path/*" access_granted /path也RewriteBase – 也许它是连接不知何故,我不知道

添加空的.htaccess给出403错误

当我添加一个空的.htaccess文件到服务器根( touch .htaccess )我得到一个403错误。 samme错误出现,无论我放在文件中(我试过指定<LIMIT>指令等)。 auth指令的例子我试过了: <Limit GET POST> Order deny,allow AuthType Basic AuthUserFile /path/to/file AuthName "Tits for Haiti etc" Require valid-user </Limit> 这是怎么回事?

不同的过期标题为特定的URL

整个应用程序在.htaccess中设置了一个全局过期头文件我有一个URL eg / current,我需要一个不同的过期头文件。

使用.htaccess绝对地将任何东西redirect到新的域

好吧,所以我需要一个简单的redirect: Redirect 301 / http://www.new.com/ 类似的,除了我想要捕捉任何东西,如: www.old.com/blah/blah/?xyz=123&aaaaabbbb=erewr3ttt#ewtjhirhjerh 并发送给用户: www.new.com 应该是容易的权利? 找出如何做到这一点并不容易。 使用上面的规则,我们仍然得到404的东西是不存在的,而不是redirect规则只是得到一切。

什么是我的htaccess mod_rewrite的nginx equalant?

以前我在我的CodeIgniter网站上使用运行Apache的linode VPS。 今天我安装了nginx,我的网站登陆页面即将到来,但其他使用htaccess重写URL的页面并没有到来。 这是我的htaccess, RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 什么是我的htaccess nginx equalent? 在codeigniterconfiguration和应用程序中,我还需要做什么修改? 对于codeigniterconfiguration中的URI协议,我正在使用, $config['uri_protocol'] = 'PATH_INFO'; 这将与Nginx的工作?? ..

.htaccess – redirect非www到www和保留子域从redirect

所以,在我的主域“domain.com”上,我创build了几个来自cPanel的子域名,比如“sub1.domain.com”和“sub2.domain.com”。 他们在服务器上的真实位置是在“domain.com/sub1”和“domain.com/sub2”中。 现在,我想redirect非WWW与.htaccess www,这是目前我所拥有的: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301] </IfModule> 这工作。 当有人inputdomain.com时,它将被redirect到www.domain.com。 然而,当有人进入sub1.domain.com,他将被redirect到www.domain.com/sub1 – 我不想,它需要在sub1.domain.com。 我应该在.htaccess文件中添加什么来实现这个目标?

如何按最后修改的顺序sortingapache目录列表

# SET DISPLAY ORDER IndexOrderDefault Descending Name 上面的值是用来sorting目录列表​​在降低名称值如何创build类似的结果sorting目录在最后修改order.i使用.htaccess.please不显示替代方法 # SET DISPLAY ORDER IndexOrderDefault last modified 指定默认的目录显示顺序: 这是我的.htaccess文件的样子 RewriteEngine On RewriteBase / # Disable server signature ServerSignature Off

一个RewriteCond多个RewriteRules

我需要保留所有的用户查询string。 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^$ index.html?page=home&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^about$ index.html?page=about&%1 RewriteCond %{QUERY_STRING} ^(.*)$ RewriteRule ^contact$ index.html?page=contact&%1 我怎样才能为所有RewriteRules指定RewriteCond? 我不期待单一的通用控制器RewriteRule,因为这是一个小的静态网站。

设置IIS以提示input用户名/密码窗口而不是使用窗体?

在一个使用.htaccess的Linux机器上,你可以拒绝对文件夹等的访问。当用户试图访问该目录/文件时,popup一个窗口询问用户名/密码。 你将如何在iIS 6上做到这一点?