Articles of .htaccess

使用.htaccess从Amazon S3 CloudFront提供文件

我的理想设置是采取当前的客户端站点,上传一个.htaccess与里面的正则expression式,将匹配的URI,如果它find一个特定的文件扩展名,它会使用相同的path,但有一个更改的域。 即。 正常path: http://www.domain.com/something/images/someimage.jpeg http://www.domain.com/assets/js/jquery.js .htaccess翻译会把上面的内容变成: http://mycdn.other.com/something/images/someimage.jpeg http://mycdn.other.com/assets/js/jquery.js 我连续search几个小时,没有运气。 再次,这是为了实际利用亚马逊的CloudFront。 S3已经挂载到网站进行备份和使用s3fs存储文件,但是这并不能解决问题,因为它直接使用S3而不是使用CloudFront。

在Ubuntu 10.04上.htaccess问题

昨天我在我的Ubuntu 10.04上安装了LAMP。 起初一切似乎都很好,但是,当我启动我的PHP应用程序(我从Windows 7中复制它,我使用XAMPP),它不接受我的.htaccess文件。 所以我所有的URL都被打破了。 我为.htaccess工作。 1.在./sites-available/中创build单独的configuration文件时,我将“目录”部分的AllowOverride从“ None更改为“ All <Directory /some_path/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> 2.我的.htaccess文件的第一行是RewriteEngine On 。 在XAMPP的Windows上一切正常。 当我启动http:// localhost它给了我500内部服务器错误。 当我将AllowOverride更改回None ,它将在我的根文件夹中打开index.html,而不是index.php。 UPD:error.log说关于错误500: [Sat Jun 26 09:40:53 2010] [alert] [client 127.0.0.1] /some_path/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the […]

htaccess .html重写exception

好吧,我需要添加一个exception! 我怎样才能做到这一点? 我目前使用RewriteRule ([^.]+).html $1 [R=301,L]来重写所有的.htmlurl 我确实需要google.htmlvalidation文件的例外。 我怎样才能设置这个exception? 我试过这个,但它不工作。 有任何想法吗? RewriteCond $1 !^(google022e525bdb654772.html|googleb5e92d18c6640aeb.html)/? 我试了 RewriteCond $1 !^(google022e525bdb654772.html|googleb5e92d18c6640aeb.html)

Snow Leopard Server是否支持.htaccess?

我在一个需要在.htaccess文件中使用mod_rewrite规则的网站上工作。 但是,当上传文件到这个新的OSX 10.6服务器安装(与Apache 2.2.13),它只是消失。 我敢肯定,这不仅仅是不可见的文件没有显示 – 我有这些设置为我的FTP应用程序中可见,虽然我没有shell访问来validation他们在那里。 而phpinfo显示mod_rewrite被启用。 然而,没有任何规则适用。 我不是服务器pipe理员,但他说任何以“。”开头的文件。 不受任何OSX服务器的支持。 我很确定情况并非如此,但需要澄清。 如果这实际上是可能的,那么我可以给他什么build议让它起作用?

ServerAlias无法正常工作

我有一个VPS,我已经configuration托pipe多个网站与基于名称的托pipe。 这只是使用example.com和www.example.com 。 它也适用于example.net ,但是当我尝试example.net时 ,它恢复到我的默认站点configuration,这只是显示我的默认(空)index.html页面。 这是默认文件: <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible […]

将url转换为子网域?

我有这个url http://www.example.com/user.php?user=solomon 我想将其转换成 http://solomon.example.com 我怎样才能做到这一点!! 谢谢 :)) ps即时通讯使用plesk

Apache Limit指令不能按预期方式工作

我想使用“限制”来允许GET和POST,只有特定的站点才能访问需要authentication的页面。 我想要从某个IP的GET和POST的身份validation,谁应该能够访问而无需身份validation。 <Limit GET POST> allow from allowableSite.com </Limit> 这不起作用。 一切都是非法的 <Limit GET POST> allow from all </Limit> 这也不pipe用。 一切仍然是未经授权的(401) 唯一通过authentication的是这个 <Limit GET POST> satisfy any </Limit> 然后,任何GET或POST将成功…但这不是我想要的,因为我只想访问从某个站点可用。 而“允许”没有按预期工作。 有什么东西可以configuration在其他地方造成这种行为? 任何帮助深表感谢。

.htaccess文件不适用于自身,除非编辑httpd.conf,否则不起作用

我有一个我刚刚设置的CentOS服务器,并将其设置为httpd.conf文件中的DocumentRoot /var/www/html/SITENAME 这工作正常。 该文件夹中的/var/www/html/SITENAME/.htaccess规则不工作/应用自己,除非我把httpd.conf文件中的.htaccess规则,在这种情况下,它的工作原理。 如何使该文件夹中的.htaccess规则实际应用于自己,因此当访问www.SITENAME.com .htaccess文件时,

301从www.example.com/thisredirect到.example.com

我想将www.example.com/this/或example.com/this/redirect到.example.com 目前在我的.htaccess文件中,我有: RewriteEngine on RewriteCond ${HTTP_HOST} ^(www\.)?example\.com/this$ RewriteRule ^(.*) http://that.example.com/$1 [R=301,L] 然而,这不适合我。

在一个SSI中,包含的文件是否可以被redirect到.htaccess文件中

我有一些旧的HTML页面,其中包括SSI包括在所有页面中的某些HTML。 所以,SSI看起来像这样: <!–#include virtual="/includes/noNav/footercode.html"–> 但是我想将包含的文件从/includes/noNav/footercode.html移动到/includes/footercode.html,所以我在.htaccess文件中实现了这样的redirect: # Redirect permanent /includes/noNav/footercode.html http://intranet.myorg.org/includes/footercode.html 但是现在我得到错误说“无法包含”/includes/noNav/footercode.html“在parsing文件”所以,redirect不能在包含的文件上工作? 另外,如果我直接浏览到旧path,它将正确地redirect我。 但是,如果包含path,则会失败。