.htaccess and seo-friendly urls

前端 未结 3 433
被撕碎了的回忆
被撕碎了的回忆 2020-12-06 22:58

We have an ecommerce site right now that carries a range of brands. The brand pages carry urls as follows:

  1. http://www..com/catalog/brand/vi
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 23:58

    The apache feature you are looking for is called mod_rewrite. You should be able to google and find good resources for help here.

    The basic idea is you'll specify a regular expression matching and then a replacement pattern. You can set it to do a 301 redirect, but the default is to not redirect the user, just access the re-written url.

    Here's an example:

    RewriteEngine On
    RewriteRule (.*) index.php
    

    The RewriteRule says to rewrite any matching url(.*) to index.php. This is not particularly useful for most files. I'm sure you'll have plenty of examples as this is a common problem.

提交回复
热议问题