我已经在VPS上设置了一个WordPress和DNS来将域名redirect到我的服务器。 但是我很难隐藏服务器的IP地址。 实际上,当我从我的域名redirect到服务器时,URL从www.example.com/wordpress更改为XXXXXX/wordpress ( XXXXXX是IP地址)。
所以我试图改变域名的设置中的网站的URL。 不过,我陷入了服务器和域名之间的循环。 在设置中,我将其更改为http://www.example.com/wordpress而不是http://XXXXXX/wordpress
这是我的VirtualHost的configuration: /etc/apache2/sites-available/default
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin [email protected] ServerName example ServerAlias example.com *.example.com DocumentRoot /var/www/ ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined <Directory /var/www/wordpress/> Order deny,allow Allow from all Satisfy any </Directory> </VirtualHost>
在这里我的.htaccess /var/www/wordpress/.htaccess
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wordpress/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule>
而在我的日志中,我们可以看到我有一些内部redirect
strip per-dir prefix: /var/www/wordpress/index.html -> index.html applying pattern '^index\\.php$' to uri 'index.html' strip per-dir prefix: /var/www/wordpress/index.html -> index.html applying pattern '.' to uri 'index.html' rewrite 'index.html' -> '/wordpress/index.php' trying to replace prefix /var/www/wordpress/ with /wordpress/ internal redirect with /wordpress/index.php [INTERNAL REDIRECT] strip per-dir prefix: /var/www/wordpress/index.cgi -> index.cgi applying pattern '^index\\.php$' to uri 'index.cgi' strip per-dir prefix: /var/www/wordpress/index.cgi -> index.cgi applying pattern '.' to uri 'index.cgi' rewrite 'index.cgi' -> '/wordpress/index.php' trying to replace prefix /var/www/wordpress/ with /wordpress/ internal redirect with /wordpress/index.php [INTERNAL REDIRECT] strip per-dir prefix: /var/www/wordpress/index.pl -> index.pl applying pattern '^index\\.php$' to uri 'index.pl' strip per-dir prefix: /var/www/wordpress/index.pl -> index.pl applying pattern '.' to uri 'index.pl' rewrite 'index.pl' -> '/wordpress/index.php' trying to replace prefix /var/www/wordpress/ with /wordpress/ internal redirect with /wordpress/index.php [INTERNAL REDIRECT]
任何build议,欢迎!
我find一个解决scheme,我打电话给我的DNS提供商的技术支持,我们发现我错误地configuration了它。 为了帮助那些可能在这里遇到同样问题的人,
我的DNS提供商是1&1,我做了一个httpredirect到我的IP,这是错的。 正确的方法是将域名设置为Web组件,并在DNS参数中将Alogging设置为服务器的IP地址。
我犯了这个错误,因为我认为networking组件是由1&1的网站build设者制作的网站。
感谢您的回复user378702
您可以将DocumentRoot更改为/ var / www / wordpress /
DocumentRoot /var/www/wordpress/
编辑:
如果你想隐藏服务器IP,你可以使用新的服务器作为代理服务器,nginx和nginxredirect到apache服务器,dnsconfiguration到代理服务器。