htaccess file's tag archives

Change Domain and Keep All Links with .htaccess

The following RewriteRule lives in the .htaccess file at olddomain.com and tells any request coming in to that domain to swap olddomain.com out and replace it with newdomain.com. This includes ANYTHING after the trailing slash, like a direct link to a previous post. So http://olddomain.com/this/direct/link gets sent properly to http://newdomain.com/this/direct/link The important part is the [R=301] which sends a 301 (Permanent) Redirect header. That tells search engines that the page ha...

用.htaccess设置禁止显示Apache目录列表

注意:使用此方法不当时,设置的.htaccess文件会引起403 Forbidden 禁止访问的问题 如何禁止 Apache 显示目录列表呢? 缺省情况下如果你在浏览器输入地址:http://localhost:8080/ 并且你将你的目录索引文件设置为 index.html,且你的文件根目录里有 index.html,浏览器就会显示 index.html的内容,如果没有 index.html,浏览器就会显示文件根目录的目录列表,目录列表包括文件根目录下的文件和子目录。(注:索引文件的设置:)#在这里,你可以设置某个目录被请求时,首先执行的文件 同样你输入一个虚拟目录的地址:http://localhost:8080/b/ 如果该虚拟目录下没有 index.html,浏览器也会显示该虚拟目录的目录结构,列出该虚拟目录下的文件和子目录。 如何禁止 Apache 显示目录列表呢? 在 httpd.conf文件里找到类似这样指令: 将指令作这样的修改: 方法一:在Options Indexes FollowSymLinks在Indexes前面加...

16 Useful .htaccess Tricks and Hacks For Web Developers

The .htaccess files (Hypertext Access file) is a very powerful configuration tool on Apache web server. The Apache web server has a number of configuration options that are available to the server administrator. The .htaccess is a simple ASCII text file placed in your website root directory. You can create and edit an .htaccess file using a text editor like notepad. Here in this blog post I have come up with useful 16 tips and hacks to configure your web server. As a configuration file ....