将子域重定向到其他IP地址,而不更改子域名称—获取内部服务器错误


Redirect sub domain to other IP address without changing sub domain name getting internal server error

我想从domain_name/directory_name/file_name/重定向到http://xx.xx.xx.x/project_name/controller/但在URL中,我想显示domain_name/directory_name/file_name/。为此,我在.htaccess文件中编写了以下代码

  RewriteEngine On
  RewriteCond %{HTTP_HOST} !directory_name/file_name/$ [NC]
  RewriteRule ^(.*)$ http://xx.xx.xx.x/project_name/controller/$1 [P]

当我写时

  RewriteEngine On
  RewriteCond %{HTTP_HOST} !directory_name/file_name/$ [NC]
  RewriteRule ^(.*)$ http://xx.xx.xx.x/project_name/controller/$1 [L,R=301]

然后从directory_name/file_name/重定向到http://xx.xx.xx.x/project_name/controller/但是显示http://xx.xx.xx.x/project_name/controller/在URL中。

为此,我将[L,R=301]改为[p],作为http://www.inmotionhosting.com/support/website/htaccess/redirect-without-changing-url网站,但它给我以下错误

 Internal Server Error
 The server encountered an internal error or misconfiguration and was unable   to complete your request.
 Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
 More information about this error may be available in the server error log.

请帮帮我。这将是一个很大的帮助。

我得到了一个答案。只需启用您的mod_proxy_http Apache模块。
  Go to your httpd.conf file and uncomment proxy_http_module
  Restart wamp

引用-用[p]代理标志重写.ht进程