【问题标题】:Make a specific URL redirect to the correct folder using .htaccess使用 .htaccess 将特定的 URL 重定向到正确的文件夹
【发布时间】:2014-10-30 15:01:13
【问题描述】:

我想知道是否可以重定向 URL 内专门设置的 .htaccess 以重定向到我的应用程序文件所在的正确文件夹?到目前为止,我在 .htaccess 文件中所做的操作如下所示,

Options -Indexes

RewriteBase /mainfolder/cakephpfolder/

Options +FollowSymlinks
RewriteEngine on
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]

我想要的是,当我使用此 URL http://www.mysamplesite.org/desired/url 时,它将使用位于 /mainfolder/cakephpfolder/ 中的文件。基本上,我想掩盖我以前看起来像http://www.mysamplesite.org/mainfolder/cakephpfolder 的网址,并使它看起来像我想要的网址。那可能吗?非常感谢。

【问题讨论】:

    标签: php .htaccess cakephp


    【解决方案1】:

    尝试类似:

    RewriteRule ^desired/url$ /mainfolder/cakephpfolder/ [NC,L]
    

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-12
      • 1970-01-01
      • 2013-10-08
      • 1970-01-01
      相关资源
      最近更新 更多