我希望使用解析的IP地址而不是主机名来连接到服务器。下面是我的代码片段:
// Get domain name from URL
String domainName = url.substring("http://".length(),
url.indexOf("/", 8));
// Get IP address as string
InetAddress inet = null;
try {
inet = InetAddress.getByName(domainName);
我有一个htaccess文件,将所有urls和子域重定向到index.php。
它在一个域上工作得很好,但在另一个域上就不行了。唯一的区别是一个域是.ca,另一个域是.com。
它们都托管在同一台服务器上。这是我的access文件,如果有人能告诉我这个文件中是否有什么东西导致了这个问题,我们将不胜感激。
谢谢
RewriteEngine on
#this rule removes www from the URL if its used
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301