【问题标题】:htaccess rewrite folder to folder/filename wordpresshtaccess 将文件夹重写为文件夹/文件名 wordpress
【发布时间】:2014-12-09 04:33:05
【问题描述】:

我在 /subfolder 中有一个 wordpress 网站。

在根目录下,有一个名为 /reports/ 的文件夹

我需要重写 url 以便 /reports/ 变为 /reports/index.php 但 wordpress 正在将路径更改为 /reports/。 (我找不到页面)

这是我的 .htaccess:

RewriteEngine on
RewriteBase /


# Only apply to URLs that aren't already under /wordpress2.
RewriteCond %{REQUEST_URI} !^/wordpress2/

# Rewrite all those to insert /wordpress2.
RewriteRule ^(.*)$ /wordpress2/$1

# Redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?website.com.au$
RewriteRule ^(/)?$ wordpress2/ [L]


RewriteCond %{HTTP_HOST} ^/reports$ [NC] 
RewriteRule ^(.*)$ /reports/index.php/$1 [L,R=301]

【问题讨论】:

    标签: wordpress .htaccess


    【解决方案1】:
    RewriteCond %{HTTP_HOST} ^freeloancalculator.com.au/reports$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.reeloancalculator\.com\.au/reports$
    RewriteRule ^/?$ "http\:\/\/reeloancalculator\.com\.au/reports/index.php\/" [R=301,L]
    

    【讨论】:

    • 谢谢!请您将网站地址更改为:website.com.au 吗?我现在就试试你的代码。。谢谢
    【解决方案2】:

    我没有尝试过,但我认为这会对你有所帮助..

    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^([^/]+)/index.php /reports=$1/ [NC]
    

    【讨论】:

      【解决方案3】:

      通过添加./ /index.php,它解决了这个问题

      # BEGIN WordPress
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ./ /index.php [L]
      </IfModule>
      
      # END WordPress
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-11-20
        • 2014-01-13
        • 2012-09-07
        • 1970-01-01
        • 2012-11-22
        • 1970-01-01
        • 2016-11-28
        • 1970-01-01
        相关资源
        最近更新 更多