Pseudo-Static URLs in addition to the. htaccess and template links to change, what else should be noted?
This post was last edited by sky94132003 on 2014-06-24 17:22:34
Recent sites want to change URLs to pseudo-static URLs
The following settings have been made in. htaccess,
Rewriteengine on
Rewriterule news/([1-9]+[0-9]*) $ news_info.php?id=$1
Rewriterule news/([1-9]+[0-9]*)/$ news_info.php?id=$1
Manual input: URL/news/123/
has been able to successfully go, of course, CSS path will be modified,
Also need to change the template RELATED links?
For example, in a news list, change the news_info.php?id=$_get["id" to/news/$_get["id"]/
So...
First step: Set the. htaccess
Step Two: Modify the links in the template?
Is this wrong? Or should there be more to be done?
In addition, in this case, the host consumption and load impact is not big?
------Solution--------------------
1. Using the rewrite (regular), the CPU will have some occupancy, but the impact is small.
2. Connections in templates (Nellian) It's best to write a way to do it.
For example
/news.php?id=123 Rewrite for/news/123
Echo ' NEW List ';
function URL ($file, $id) {
return $file. ' /'. $id;
}
If one day do not want to use rewrite the URL want to use back/news.php?id=123
You only need to modify
function URL ($file, $id) {
Return $file. Php?id= '. $id;
}
This will not change every URL.