In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how php removes the .php suffix from url". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to remove the .php suffix from url by php".
Php remove the .php suffix in url: 1, find and open the "extra/httpd-vhosts.conf" file under apache; 2, remove the php suffix by configuring pseudo-static.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer
How does PHP remove the .php suffix from url?
Like a link like this
Http://example.com/xxx.php
How to turn it into
Http://example.com/xxx and can be accessed in the browser
Is it using .htaccess? How?
Methods:
Just be pseudo-static.
Demo:
Localhost/news.php?type=music&id=100 We hope that this address can replace localhost/news-music-id100.html with the following access url
To do this, under extra/httpd-vhosts.conf under apache, make the following settings:
DocumentRoot "C:/myenv/apache/htdocs/static2" # Directory configuration node, which is used to specify files or pictures in this directory. Access rights # set the error page of the virtual host, welcome page ServerName www.hsp.com#, you can specify whether to allow people to access # Allow from all# whether to list the file directory structure # if you want to list how indexes does not want none#Options indexes# to configure the first page of the website, how to configure the DirectoryIndex abc.html abc2.html# error page Guide users to introduce a new page errorDocument 404 / 404.html# to configure our rewrite rule RewriteEngine On [x4] # rewrite rules if aaa.html jumps to news.php#$1 to indicate reverse reference, the content of the first subexpression # indicates that if the content of the subexpression is directly referenced in the regular specification Then use\ n# if it is later, use $nRewriteRule news- ([a-zA-Z] +)-id (\ d+)\ .html$ news.php?type=$1 [x5] & id=$2 so far, I believe you have a deeper understanding of "how php removes the .php suffix in url". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.