大网数据广告活动
网站运营与故障问答

How to remove port number from the URL?

· 52CE 我爱测

I need a help for the remove port number from the URL. I host a site on VPS using xampp virtual host. Everything is working perfectly,but cant access domain without port number EX: www.example.com:90 This URL is working but I nee…

问题原文

原帖链接 · androidpc · CC BY-SA 4.0

I need a help for the remove port number from the URL. I host a site on VPS using xampp virtual host. Everything is working perfectly,but cant access domain without port number EX:

www.example.com:90

This URL is working but I need to remove this port number. The correct URL should be:

www.example.com

Here is my xampp vhost file code

<VirtualHost *:90>
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot "C:\xampp\htdocs\abc.com\public"
ErrorLog "logs/abc.com-error.log"
CustomLog "logs/abc.com-access.log" common
<Directory "C:\xampp\htdocs\abc.com">
    Require all granted
Order allow,deny
Allow from all
  </Directory>

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

Change the port number from 90 to 80 to remove it from the URL. The default port number for HTTP is port 80. If you use any other port number, that port number has to be specified in the URL.

Similarly if you use HTTPS (with an SSL certificate) your port number has to be 443 if you don't want the port number to appear in the URL.

For HTTP and HTTPS it is not possible to use any method other than the URL to change the port number. Some newer protocols use SRV DNS records to set the port number, but HTTP and HTTPS do not support that. See Can DNS point to specific port?

If your ISP or hosting company has blocked port 80, you are out of luck. That shouldn't be the case for any VPS though.

If you are running another web server on port 80 already, you will need to combine the two. That can usually be accomplished easily by using reverse proxy from one web server to another.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-10-16)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。