Php html。在浏览器地址栏显示ip地址,而不是实际的网站地址

Php html。在浏览器地址栏显示ip地址,而不是实际的网站地址,php,html,server,Php,Html,Server,我正在做一个项目,在一个地方,我想把我的正常网址改为ip地址,即http://www.mydomain.com/index.php将改为http://192.xx.xxx.25/。这将只是一个特定的页面,而不是整个网站。 有人能帮我怎么做吗。谢谢……如果您使用的是Apache,您可以使用htaccess Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com[nc] RewriteRule ^(

我正在做一个项目,在一个地方,我想把我的正常网址改为ip地址,即http://www.mydomain.com/index.php将改为http://192.xx.xxx.25/。这将只是一个特定的页面,而不是整个网站。
有人能帮我怎么做吗。谢谢……

如果您使用的是Apache,您可以使用htaccess

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com[nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]

//301 Redirect Old File
Redirect 301 /specific_page_slug http://192.168.0.1
对于Nginx,您可以在Nginx配置文件中添加以下内容

location Old {
  rewrite ^(.*)$ File redirect;
}

location /specific_page_slug {
  rewrite ^(.*)$ http://192.168.0.1 redirect;
}

location / {
  if ($http_host ~ "^example.com"){
    rewrite ^(.*)$ http://www.example.com/$1 redirect;
  }
}

什么你能澄清一下你想做什么吗?一个具体的页面?这将比你想象的要复杂一些。我很关心你的意图…我只想把我的正常网址(http://www.mydomain.com)改成http://192.268.xx.xxx这样的ip地址。更详细一点,当有人试图打开http://www.mydomain.com/index.php时,它将被重定向,浏览器地址栏将显示一些ip地址http:/xxx.xx.xxx.xx/,而不是http:/www.mydomain.com/index.php.What?这不是答案!我们甚至都不知道这部作品的主播是什么!标记。如果我理解良好,OP希望将页面重定向到特定IP地址。使用什么?在什么平台上?htaccess与Apache相关。这怎么不太抽象呢?