Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set pseudo-static for virtual host

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

How do virtual hosts set pseudo-static? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Virtual hosting providers generally provide pseudo-static rules, but we can also set them ourselves. Here the virtual host distinguishes between the Linux virtual host and the Windows virtual host. Under the two systems, the pseudo-static writing will be different. In addition, the system used by the website will also cause differences to the pseudo-static writing method, such as CMS system, WordPress system and so on. Let's explain in detail how to set the pseudo-static of the virtual host.

1. Pseudo-static setting skills of Imperial CMS

Imperial CMS suggests generating static pages directly, but sometimes you do want pseudo-static. Here is an example of Imperial CMS7.0. Set pseudo-static under PHP virtual host:

1. Confirm that the space supports pseudo-static, and some space merchants need to enable the pseudo-static function manually.

3. Create a new .htaccess file and put it in the root directory of the website.

The following rules are written in the .htaccess file: (note that the rules in the rules file should be consistent with those set in the background)

# Open RewriteEngine mode to the RewriteEngine On# information content page: showinfo- [!-- classid--]-[!-- id--]-[!-- page--] .htmlRewriteCond% {QUERY_STRING} ^ (. *) $RewriteRule ^ showinfo- (. +?) / .html$ / e/action/ShowInfo.php?classid=$1&id=$2&page=$3# Information list: listinfo- [!-- classid--]-[!-- page--] .htmlRewriteCond% {QUERY_STRING} ^ (. *) $RewriteRule ^ listinfo- (. +?)-(. +?) / .html$ / e/action/ListInfo/index.php?classid=$1&page=$2# title classification list page: infotype- [!-ttid--]-[!-- page--] .htmlRewriteCond% {QUERY_STRING} ^ (. *) $RewriteRule ^ infotype- (. +)-(. +?) / .html$ / e/action/InfoType/index.php?ttid=$1&page=$2#TAGS information List page: tags- [!-- tagname--]-[!-- page--] .htmlRewriteCond% {QUERY_STRING} ^ (. *) $RewriteRule ^ tags- (. +?)-(. +?) / .html$ / e/tags/index.php?tagname=$1&page=$2

II. WordPress pseudo-static setting rules

Modified WordPress fixed link pseudo-static, but the page can not be opened, this situation occurs because of the lack of pseudo-static rules.

WordPress fixed link pseudo-static setting rules, is based on your host environment to determine, do not need plug-ins, wordpress running on the Internet is nothing more than IIS/Apache/Nginx these three environments.

WordPress fixed link pseudo-static setting skills are varied, need to be seated. If you are using a virtual host, most IDC service providers support wordpress pseudo-static, and you can directly modify the fixed link settings in the background.

1. Linux server environment

Please make sure that your root directory opened 777 permissions, if it has been opened, in the moment after modifying the custom fixed link, will automatically generate a .htaccess file in the host root directory, open to see if the rules have been generated, then OK, there is no need to look down.

If no .htaccess is generated, or if there is no content in .htaccess, you need to manually create a txt file, use the upload software to modify the name .htaccess, paste the Apache or Nginx rule code, save and upload to the root of the site.

Apache rule

RewriteEngine OnRewriteBase / RewriteRule ^ index\ .php $- [L] RewriteCond% {REQUEST_FILENAME}!-fRewriteCond% {REQUEST_FILENAME}!-dRewriteRule. / index.php [L]

Nginx rule

Location / {if (- f $request_filename/index.html) {rewrite (. *) $1/index.html break;} if (- f $request_filename/index.php) {rewrite (. *) $1 request_filename index.php;} if (!-f $request_filename) {rewrite (. *) / index.php;}

2. Pseudo-static rules under Windows host IIS environment

The windows host you use must be installed with Rewrite components to support pseudo-static. Ask whether the host used by your cloud service provider supports pseudo-static. If so, please read on.

If the host supports pseudo-static and cannot be pseudo-static after modifying the wordpress fixed link, a httpd.ini is automatically generated in the root directory. If it is not generated, create a txt text, change the name to httpd.ini, copy and paste the following code, and save and upload to the root directory.

[ISAPI_Rewrite] # Defend your computer from some worm attacks#RewriteRule. * (?: global.asa | default\ .ida | root\ .exe |\.). *. [hourCacheClockRate 3600RepeatLimit tag/ Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule / tag/ (. *) / index\ .php\? tag=$1RewriteRule / software-files/ (. *) / software-files/$1 [L] RewriteRule / images/ (. *) / images/$1 [L] RewriteRule / sitemap.xml / sitemap.xml [L] RewriteRule / favicon.ico / favicon.ico [L] # For file-based wordpress content (i.e. Theme), admin Etc.RewriteRule / wp- (. *) / wp-$1 [L] # For normal wordpress content, via index.phpRewriteRule ^ / $/ index.php [L] RewriteRule / (. *) / index.php/$1 [L]

PS:

If you do not know what system the host you are using, or the vps host of the Linux or Windows system, will not configure pseudo-static rules, you can consult your cloud service provider, they will help you achieve wordpress pseudo-static, although set pseudo-static, only the pseudo-static suffix displayed, in fact, it is still dynamic pages, if you want completely static pages, you can install WP Super Cache or Hyper Cache plug-ins to generate static page cache for the whole site.

After reading the above, have you mastered how to set the pseudo-static method of the virtual host? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report