开发者

How to set-up friendly URLs

I am looking for your recommandations on what would be the best way to implement friendly URLs.

What I currently do is redirect all 404 requests to folders or files that do not exist to index.php. index.php reads the query string and makes a database call to see if the url is in the page_urls table then based on the page type fetches content etc etc.

The .htaccess contains the following lines:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* i开发者_运维知识库ndex.php [L]

Is there a more "clever" way of doing this please? Thank you.

Thank you.


The best way I've found is to do something like the following:

RewriteEngine on 
RewriteRule ([a-zA-Z0-9_-]*)\.html index.php?page=$1 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜