Articles of .htaccess

访问htaccessvariables

我正在使用htaccess来阻止所有访问我们的开发服务器与以下代码: AuthType Basic AuthName "Auth" AuthUserFile /var/htpasswd Require valid-user Order allow,deny Satisfy any 我已经在Apache httpd.conf中设置了一个名为DEV的variables。 我正在使用它在php中的configuration文件,但我怎么会只使用该身份validation设置时使用身份validation

使用.htaccess进行URLredirect

正如我已经改变了我的dynamicurl静态url。 现在我有一个dynamic的url已经分发到这么多的网站。 因为我不想松动stream量每当有人试图访问我的dynamicurl。 我的旧url是http://www.mysite.com/download.php 我已经在.htaccess中写了一个规则 Redirect http://www.mysite.com/download.php http://www.mysite.com/download/?page=download 但它不工作… 任何人都可以帮助我在这方面.. 我的代码: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / Header set Cache-Control "max-age=2419200, public" Redirect http://www.mysite.com/download.php http://www.mysite.com/download/?page=download

nginx重写竹发票的规则

我只是从Apache的networking服务器迁移到Nginx,我不能让.htaccess转换正常工作。 我试图使用的应用程序是竹发票[ http://bambooinvoice.org/ ],它带有一个默认的.htaccess,看起来像这样: RewriteEngine on RewriteRule ^$ /index.php [L] RewriteCond $1 !^(index\.php|img|css|js|robots\.txt|favicon\.ico|update\.php|install\.php) RewriteRule ^(.*)$ /index.php/$1 [L] 任何人都可以build议如何将这套重写规则翻译成Nginx格式? 我没有任何运气..

通过httpd.conf阻止引用域

我正在使用以下代码来阻止正在接收大量垃圾邮件stream量的站点上的引用垃圾邮件。 我被告知 ,在使用httpd.conf的服务器负载方面效率更高,但是我对这种types的操作基本不熟悉,并没有发现特定于该情况的教程。 任何人都可以帮助教程或资源显示类似的方法阻止引用域? RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} spammer-one\.com [NC,OR] RewriteCond %{HTTP_REFERER} spammer-two\.com RewriteCond %{HTTP_REFERER} spammer-three\.com RewriteRule .* – [F] 另外值得花时间通过httpd.conf阻止,相比上面的htaccess代码,它是否会显着减less服务器负载?

.htaccess重写问题

下面是我的共享主机的网站的.htaccess文件 – 我试图发送所有的请求到index.php参数'q'我想分析数据等…除非它是一个现有的文件或目录。 所以我的问题,如果我试图浏览到一个实际的目录,希望得到一个未经授权的通知(选项-Indexes)它将我发送到我的index.php,我也注意到print_r($_GET)它给了我这个: Array ( [q] => 403.shtml ) AddDefaultCharset UTF-8 Options -Indexes +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] </IfModule> 帮助将不胜感激,如果可能:)

颠倒.htaccessredirect规则

让我以身作则。 说,我在我的.htaccess文件中有这个redirect规则: RedirectMatch 301 ^/([^/]+)/([^/]+)/$ http://www.example.com/$2 它基本上是把http://www.mysite.com/sports/test-post/redirect到http://www.mysite.com/test-post/ 。 现在,我该如何修改.htaccess规则来做相反的事情呢? (即将http://www.mysite.com/sports/test-post/redirect到http://www.mysite.com/sports/test-post/ )

htaccess中的Apache“filesmatch”指令与预期的不匹配

我在.htaccess文件中有一个filesmatch指令: <filesMatch "admin"> AuthUserFile /var/www/html/.htpasswd AuthType Basic AuthName "Protected Area" require valid-user </filesMatch> 它匹配http://www.website.com/admin (和/ admin / edit_page等子页面) 但不是http://www.website.com/index.php/admin (我也有一个mod_rewrite规则来隐藏大部分网站的index.php,不知道这是否有冲突)。 国防部重写规则: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be […]

我正在使用mod_rewrite,并使用重写规则,有没有办法让我得到的URL在地址栏服务器端看到?

我可以重build实际的URL后重写规则,但是有没有办法让我获得URL预重写规则? 另外,当我在IIS 7.5中运行php,并在web.config中重写规则时,如何在我的php中获得预重写URL?

.htaccess – 太多的redirect

我从以下两个.htaccess文件中收到“太多的redirect”错误。 域1上的.htaccess Redirect 301 / http://www.domain2.com/ 域2上的.htaccess RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* /forum/ [L,R] RedirectMatch permanent ^/$ /forum/ # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} badsite1\.com [NC,OR] RewriteCond %{HTTP_REFERER} badsite2\.com [NC] RewriteRule .* – [F] 任何人都知道redirect错误太多的原因?

htaccess重写子域并请求uri

在我的htaccess中遇到了重写条件的问题。 我需要redirect来自子域的请求。 但是,每种语言都有三个子域:en.foo.com,es.foo.com,www.foo.com。 如果他们有请求,他们必须坚持相应的子域名。 例如: 要求: fdsfds.foo.com/test 期望: www.foo.com/test 目前: www.foo.com .htaccess文件: # BEGIN .net to .com redirect RewriteEngine On RewriteCond %{HTTP_HOST} foo.net$ [NC] RewriteRule ^(.*)$ http://www.foo.com/$1 [R=301,L] # END .net to .com redirect # BEGIN force www on non-www requests RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # END force www on non-www requests […]