1

在我的 OctoberCMS 网站上,我总是需要浏览index.php. 例如:

  • 转到页面:mywebsite.com/index.php/mypage而不是mywebsite.com/mypage
  • 管理员:mywebsite.com/index.php/backend而不是mywebsite.com/backend

所有的链接都是可爱的mywebsite.com/linktopage,当我去的时候mywebsite.com/index.php,所有的链接都切换到了mywebsite.com/index.php/linktopage/。这很奇怪。

这是我的.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    ##
## You may need to uncomment the following line for some hosting environments,
    ## if you have installed to a subdirectory, enter the name here also.
    ##
    # RewriteBase /

    ##
    ## Black list protected files
    ##
    RewriteRule ^themes/.*/(layouts|pages|partials)/.*.htm index.php [L,NC]
    RewriteRule ^bootstrap/.* index.php [L,NC]
    RewriteRule ^config/.* index.php [L,NC]
    RewriteRule ^vendor/.* index.php [L,NC]
    RewriteRule ^storage/cms/.* index.php [L,NC]
    RewriteRule ^storage/logs/.* index.php [L,NC]
    RewriteRule ^storage/framework/.* index.php [L,NC]
    RewriteRule ^storage/temp/protected/.* index.php [L,NC]
    RewriteRule ^storage/app/uploads/protected/.* index.php [L,NC]

    ##
    ## White listed folders and files
    ##
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteCond %{REQUEST_URI} !\.js
    RewriteCond %{REQUEST_URI} !\.map
    RewriteCond %{REQUEST_URI} !\.ico
    RewriteCond %{REQUEST_URI} !\.jpg
    RewriteCond %{REQUEST_URI} !\.jpeg
    RewriteCond %{REQUEST_URI} !\.gif
    RewriteCond %{REQUEST_URI} !\.css
    RewriteCond %{REQUEST_URI} !\.less
    RewriteCond %{REQUEST_URI} !\.scss
    RewriteCond %{REQUEST_URI} !\.pdf
    RewriteCond %{REQUEST_URI} !\.png
    RewriteCond %{REQUEST_URI} !\.swf
    RewriteCond %{REQUEST_URI} !\.txt
    RewriteCond %{REQUEST_URI} !\.xml
    RewriteCond %{REQUEST_URI} !\.xls
    RewriteCond %{REQUEST_URI} !\.eot
    RewriteCond %{REQUEST_URI} !\.woff
    RewriteCond %{REQUEST_URI} !\.woff2
    RewriteCond %{REQUEST_URI} !\.ttf
    RewriteCond %{REQUEST_URI} !\.svg
    RewriteCond %{REQUEST_URI} !\.wmv
    RewriteCond %{REQUEST_URI} !\.mp3
    RewriteCond %{REQUEST_URI} !\.wav
    RewriteCond %{REQUEST_URI} !\.avi
    RewriteCond %{REQUEST_URI} !\.mov
    RewriteCond %{REQUEST_URI} !\.mp4
    RewriteCond %{REQUEST_URI} !\.webm
    RewriteCond %{REQUEST_URI} !\.ogg
    RewriteCond %{REQUEST_URI} !docs/.*
    RewriteCond %{REQUEST_URI} !themes/.*
    RewriteRule ^ index.php [L,NC]

    ##
    ## Standard routes
    ##
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>

谢谢。

4

1 回答 1

1

十月CMS论坛上的nanohard,回答了我的问题。这是答案;

确保mod_rewrite正在on使用a2enmod rewrite然后service apache2 restart.

来源:http ://octobercms.com/forum/post/only-index-works?page=1#post-7140

于 2015-06-21T14:24:10.190 回答