apache_conf htaccess清理网址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf htaccess清理网址相关的知识,希望对你有一定的参考价值。

# http://socreativedigital.com/7-htaccess-file-examples-that-work-for-seo-2013-05-04
# The next thing the htaccess file helped me with were clean URL’s. I was
# informed by non other then Nibbler, that my URL’s had extensions (how awful)
# and that I must rewrite them in order to make them easier for my visitors to
# remember, to make them more search engine friendly and for better security.
# A clean URL looks like this:
#
# http://www.lakanephotography.co.uk/blog/lee-allan-kane-blog
#
# as apposed to an ugly URL which looks like this:
#
# http://www.lakanephotography.co.uk/blog/lee-allan-kane-blog.html
#
# A clean URL means to serve a webpage without its extension which in my case was the .html
#
# A Google search eventually came up with this code which removes the webpage extension for HTML:
#
RewriteBase /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
#
# This code also works for PHP all you do is replace the [html] with [php] and to Nibblers
# delight, it works!
#
# IMPORTANT! To enable this code to work, you have to remove the .html extension from the
# links within your webpage HTML like this:
#
# <a href=”lee_allan_kane_photography.html”>……</a>
# <a href=”wedding-photography.html”>……</a>
#
# should look like
#
# <a href=”lee_allan_kane_photography”>……</a>
# <a href=”wedding-photography”>……</a>
#
# Which can means if you build your website offline in a folder as i do, then the links
# will stop working! This is the case for HTML but i think the PHP guys build them on a
# live server so it wouldn’t make any difference.

以上是关于apache_conf htaccess清理网址的主要内容,如果未能解决你的问题,请参考以下文章

我如何使用 .htaccess 清理 php 生成的 url

apache_conf Bot Block .htaccess #htaccess #botblock

apache_conf 通过.htaccess(主.htaccess)保护wordpress网站

apache_conf [linux:.htaccess] apache的htaccess说明。 #linux #apache

apache_conf Seguridad .htaccess

apache_conf htaccess的