duanjing3656 2011-02-06 00:11
浏览 47
已采纳

.HTACCESS的问题

I am using this .htaccess code for my website

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.website.com$ [NC]

RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).website.com$ [NC]

RewriteRule ^$ /application/index.php [L]

This checks for subdomain other than www and displays content from directory /www/application

But the problem is for the first time it works correctly and displays the correct page but when i redirect internally/go to other page it loads the content from /www/ directory and not from /www/application/ directory.

And it also shows application in the url parameter which i want to get rid of.

Ex : url = http://stackoverflow.website.com/application/user.php

I want it to be like url = http://stackoverflow.website.com/user.php - but from application directory.

Need this for a SAAS Application.

  • 写回答

1条回答 默认 最新

  • douyiqi9640 2011-02-06 01:06
    关注

    The most obvious problem with your rule is that rule is that it will only apply to the root of the domain, because of the ^$ rule. Your probably want to replace that line with something like this:

    RewriteRule ^(.*)$ application/$1 [L]
    

    That will match any URL and divert it to the same URL in your application directory. You might need to add the QSA flag to make your app work.

    I'd think the problem with "/application/" showing up in your URLs is down to the configuration of the software itself, and how it generates URLs internally. See if it has a config parameter to change its external URL.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog