Articles of .htaccess

是否有可能使.htaccess连接到数据库

是否有可能从数据库中读取.htaccess的用户名/密码(以允许多个用户),我需要使用Apache和数据库pipe理它只有没有任何PHP / Perl代码级别任何想法是高度赞赏。 问候

如何使用htaccess&apache重写/页面到/ xx / page?

想像一下三步跳跃的体育赛事,前两步完美到位,第三步跳入空中,永不回头,最终摔倒! 这就是这个问题归结为:) 第1 /somepage?ln=xx :当用户导航到/xx/somepage时,工作服务/somepage?ln=xx 。 # if user inputs nice urls /xx/somepage to serve page /someapge?ln=xx RewriteRule ^([az][az])/(.*) /$2?ln=$1 [L] 第二步:只有在给定语言的情况下才能进入主页/ xx / # if language xx given but no page given? then redirect to its home /xx/home RewriteRule ^([az][az])/?$ /$1/home [R=301,L] 第3步:碰撞 # if user inputs /somepage then redirect to default english: /en/somepage […]

如何将apache中的裸域redirect到www

我有多个裸域,我想redirect这些域名,使他们开始与www.redirecteddomain.com。 我有这个.htaccess文件在域上如何推广这个? RewriteEngine On RewriteCond %{HTTP_HOST} ^guvam\.com$ RewriteRule (.*) http://www.guvam.com$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ – [NC,L] RewriteRule ^.*$ index.php [NC,L]

阻止Apacheconfiguration文件中的GoogleBot

对于我的登台服务器,我试图找出一种方法来完全阻止search引擎机器人,而不是一个单独的.htaccess文件或robots.txt文件。 这个想法是,当在登台服务器上创build一个新站点的时候,这是不可能的。 有没有办法使用apache模块检测机器人的用户代理,并在服务器级别阻止该连接? 谢谢!

将子文件夹从httpredirect到https

我怎么能redirect到https的子文件夹,例如http://example.com/vacation-rental/115到https://example.com/vacation-rental/115

每天更改htaccess密码

我想保护一个子域名,用户只能访问1天。 是否可以设置一个cron作业,每天使用新密码自动更新一个.htpasswd文件?

许多htaccess文件,相同的IP限制

在我的networking服务器上,某些文件夹(如wp-admin / wp-login.php …)或网站(dev.company.net)仅限于我的IP地址。 家庭,家庭ipv6,VPN,办公室,办公室IPv6。 <Files wp-login.php> Order Deny,Allow Deny from all allow from 88.222.222.88 allow from 92.92.92.92 allow from 2001:DB8:123:5fcc::/64 allow from 2001:DB8:8ae:e6c4::/64 </Files> 我的家庭和办公室经常更换,我必须绕过我的所有htaccess文件再次访问。 你会看到只有一个地方的方式吗? 我可以创build一个ln -s但是这些.htaccess文件通常包含其他信息,因为它们在战略点上。 我也可以访问Apacheconfiguration,但这是大容量虚拟主机,我没有任何<directory>或<location>

使网站可用,而无需inputwww

我有一个可以通过www.example.com访问的网站。 现在我想让它也可以在example.com下访问。 我怎样才能做到这一点? 我有几个子域名,例如test.example.com,test2.example.com等我也读了一下,发现应该使用htaccess从example.com永久redirect到www.example.com。 RewriteCond %{http_host} ^example.com [nc] RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc] 所以现在应该没有重复的内容,它应该是SEO友好。 但是,我如何创buildA-record呢? 现在只有一个www.example.com。 如果我使用example.com创build一个,它将自动映射到example.com.example.com … 然后我必须在主机文件中添加一个条目。 这看起来像这样吗? 192.168.1.1 example.com 比我有一些虚拟主机的Apache的条目。 这个文件是正确的吗? <VirtualHost 192.168.1.1:80> ServerName www.example.com ServerAlias *.www.example.com ServerAlias example.com ServerAdmin [email protected] DocumentRoot /var/www/html/path <Directory /var/www/html/path> AllowOverride None Options +FollowSymLinks -Indexes -Includes +Multiviews +ExecCGI Order allow,deny Allow from all AllowOverride All </Directory> </VirtualHost> 解: […]

如何在IIS Web服务器上mod_rewrite

正如我以前的服务器是一个Linux驱动的机器我有这段代码: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?path=$1 [NS,L] </IfModule> 这段代码将这样的信息放在URL中: http://www.example.com/nr1/nr2/nr3/ 进入一个这样的数组: array ( 0 => "nr1", 1 => "nr2", 2 => "nr3") 我的新服务器机器是基于Windows 2008(IIS)的服务器。 现在我想在我的新服务器上使用mod_rewrite mod。 总之我的问题是: 任何人都可以告诉我,或者链接到一个教程告诉我,如何安装/使用mod_rewrite国防部(或任何国防部做同样的事情),并将上面的代码转换成我可以在我的基于Windows的服务器上使用的格式。 我仍然使用PHP,而不是ASP.NET ,我知道很多人会说使用Apache或东西,但不幸的是需要使用IIS。 提前谢谢了!

.htaccess不起作用

我试图用.htaccess重写一些URL,但没有任何反应! 我在Apache中启用了rewrite_module。 我想要使​​用下面的代码在htaccess中隐藏Url的.html扩展名 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html 我相信我的httpd.conf是不正确的设置。 这里是httpd.conf的代码,如果有人看到问题在哪里,并且愿意帮助我。 # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See <URL:http://httpd.apache.org/docs/2.2> for detailed information. # In particular, see # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html> # for a discussion […]