In addition to link. htaccess and template, do you need to change the pseudo-static website?

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.