如何使用的.htaccess删除URL的一部分?如何使用、htaccess、URL

由网友(执笔画素颜ご)分享简介:目前,我有我的网站上20+的网址在这甲Currently i have 20+ URLs on my site in this formatehttp://www.example.net/content/index/mission 我想从所有的URL删除/内容/指数,所以他们应该是这个样子。I want to...

目前,我有我的网站上20+的网址在这甲

Currently i have 20+ URLs on my site in this formate

http://www.example.net/content/index/mission

我想从所有的URL删除/内容/指数,所以他们应该是这个样子。

I want to remove /content/index from all URLs, so they should look something like this

http://www.example.net/mission

在换句话说,我将永远从URL中删除/内容/索引。 我敢肯定,这确实直线前进,但我不是很有经验与Apache。

In other words I would to always remove /content/index from the url. I'm sure it's really straight forward, but I'm not very experienced with Apache.

推荐答案

您将需要Apache的重写模块:的mod_rewrite

You would need the rewrite module of Apache: mod_rewrite.

然后做这样的事情:

RewriteEngine on 
RewriteRule ^content/index/(.*)$ $1

下面是mod_rewrite的正式文件:点击

Here is the official documentation of mod_rewrite: click

阅读全文

相关推荐

最新文章