簡體   English   中英

在不更改子域名的情況下將子域重定向到其他IP地址,但不會收到內部服務器錯誤

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

我想從domainname / 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/,但在URL中顯示http://xx.xx.xx.x/project_name/controller/

為此,我將[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]代理標志重寫.htacess

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM