我想从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/,但在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.
请帮助我。这将是很好的帮助。
答案 0 :(得分:0)
我得到了答案。 只需启用mod_proxy_http Apache模块。
Go to your httpd.conf file and uncomment proxy_http_module
Restart wamp