我正在创建一个博客,并希望将每个条目的标题用作URL。 该博客是从数据库中提取的,并且在单个php文件中具有代码以显示博客条目。
我希望将任何类似domain.com/blog/this-is-the-title.html的网址重定向到 domain.com/blog/index.php 但是,将URL保留在浏览器栏中作为原始URL。
编辑...
domain.com/blog/anything-that-is-here.html
应该重定向到domain.com/blog/index.php
但是,仍在浏览器地址栏中显示domain.com/blog/anything-that-is-here.html。
我希望这是有道理的。
希望这可以在.htaccess中完成。
谢谢! 里克
尝试使用[P]
You are searching for the
rewrite
function from Apache.这样的事情应该适合您的情况:
An URL like
domain.com/blog/test-title
will internally call yourindex.php
with$_GET['title'] = "test-title"
.