In addition to link. htaccess and template, do you need to change the pseudo-static website? Recently, I want to change my website address to a pseudo-static website address.
The following settings are 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
Manually enter: URL/news/123/
The operation is successful. of course, you have to modify the CSS path,
In addition, do you need to modify the template-related links?
For example, in the news list, connect news_info.php? Id = $ _ GET ["id"] to/news/$ _ GET ["id"]/
So...
Step 1: Set. htaccess
Step 2: modify the link in the template?
Is this wrong? Or should there be more to do?
In addition, will this have little impact on host consumption and load?
Reply to discussion (solution)
Or should they be integrated into automatic jump?
Should I use. htaccess or php for automatic jump?
1. when rewrite (regular expression) is used, it will occupy some CPU resources, but it will not affect much.
2. you are advised to write a method for the connection (inner connection) in the template.
For example
/News. php? Id = 123 rewrite is/news/123
Echo 'new list ';
Function url ($ file, $ id ){
Return $ file. '/'. $ id;
}
If I don't want to use rewrite url one day, I want to use/news. php? Id = 123
You only need to modify
Function url ($ file, $ id ){
Return $ file. '. php? Id = '. $ id;
}
In this way, you do not need to change each url once.
1. when rewrite (regular expression) is used, it will occupy some CPU resources, but it will not affect much.
2. you are advised to write a method for the connection (inner connection) in the template.
For example
/News. php? Id = 123 rewrite is/news/123
Echo 'new list ';
Function url ($ file, $ id ){
Return $ file. '/'. $ id;
}
If I don't want to use rewrite url one day, I want to use/news. php? Id = 123
You only need to modify
Function url ($ file, $ id ){
Return $ file. '. php? Id = '. $ id;
}
In this way, you do not need to change each url once.
Understand
Thank you!