阿帕奇友好的URL [英] Apache friendly urls
问题描述
我有PHP编写的,并在Apache上运行一个小型的CMS系统。此CMS系统使用/生成的URL的格式为:
I've got a small CMS system written in PHP and running on Apache. The format of the URLs this CMS system uses/generates is:
/display.php?PageID=xxx其中xxx只是一些整数。正如你所看到的,这些网址都不是很友好的,无论对于用户还是搜索引擎。
/display.php?PageID=xxx where xxx is just some integer number. As you can see, those URLs are not very friendly, neither for users nor search engines.
我相信,使用mod_rewrite(或类似的东西)和.htaccess文件,我应该能够配置Apache的URL重写。我以前曾经搜索过这方面的信息,但我没有找到任何简单的方法来做到这一点,它总是涉及定期EX pressions,这我不是很熟悉搞乱。
I believe that using mod_rewrite (or something like that) and .htaccess files I should be able to configure Apache for URL-rewriting. I have searched for information about this before but I did not find any easy method to do this, it always involved messing with regular expressions, which I'm not very familiar with.
由于有关的网站非常简单,小,只需5-10不同的页面,我真的希望能够C的配置,只是硬$ C $,没有任何特殊的规则或正则表达式。
Since the website in question is really simple and small, just 5-10 different pages, I would really like to be able to just hard-code the configuration, without any special rules or regexps.
我只是想以一个友好的URL映射到实际的URL,也许是这样的:
I'd just like to map a friendly URL to an actual URL, perhaps like this:
/about = /display.php?PageID=44
/products = /display.php?PageID=34
等。
是否有可能配置mod_rewrite的插件在这样一个基本的方法是什么?
Is it possible to configure the mod_rewrite plugin in a basic way like this?
有人能解释这样做的最简单的方法是什么?解释给我,好像我是一个孩子: - )
Could someone explain the easiest method to do this? Explain it to me as if I was a child :-)
在此先感谢!
推荐答案
也将像
RewriteEngine on
RewriteRule ^about$ ./display.php?PageID=44
RewriteRule ^products$ ./display.php?PageID=34
在的.htaccess
- 文件不应该是什么大不了的,我认为...
in your .htaccess
-file shouldn't be the big deal I think...
这篇关于阿帕奇友好的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!