Results 1 to 13 of 13

Thread: Wrong assets and files loading when disabling page alias usage

  1. #1
    New user
    Join Date
    04-15-18.
    Posts
    2

    Beitrag Wrong assets and files loading when disabling page alias usage

    Hello, I am using Contao 3.5.3 and I want to change my site to use engine friendly urls. I have enabled Rewrite URLs, disabled Disable page alias usage in Front end configuration settings and created default .htaccess file.

    When I load my page with single url parameter (mysite.domain/home), everything works fine, as it's loading assets and files from correct location (mysite.domain/assets, mysite.domain/files). Problem starts when adding second parameter (mysite.domain/home/second), then it's loading assets and files from wrong location (mysite.domain/home/assets, mysite.domain/files/assets).

    How should I fix that? I've been trying to set absolute paths for assets and files, but don't know really where to set it? Or should I set it in .htaccess?

  2. #2
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    So you basically want to use folder URLs? Did you enable the option in the settings (System > Settings > Enable folder URLs)?
    Contao Community Moderator
    → Support options

  3. #3
    New user
    Join Date
    04-15-18.
    Posts
    2

    Default

    Yes, I have already enabled Enable folder URLs.

  4. #4
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    Do you use an URL suffix as well? What does your .htaccess look like?
    Contao Community Moderator
    → Support options

  5. #5
    New user
    Join Date
    04-15-18.
    Posts
    7

    Default

    I have been banned trying to post my htaccess code because of anty-spam message :-/

    Anyway I do not use URL suffix, it's empty. Although I already tried with html suffix, But it didn't work.

    Here's my htaccess: https://pastebin.com/ZJu5zFVF

  6. #6
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    Change your RewriteRules as follows:
    Code:
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule .* index.php [L]
    and delete the two lines with
    Code:
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.html$ index.php [L]
    Contao Community Moderator
    → Support options

  7. #7
    New user
    Join Date
    04-15-18.
    Posts
    7

    Default

    I have made the changes to my htaccess, but the problem sadly still persists, it's not loading assets and files from correct location.

  8. #8
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    Can you post your current .htaccess again? Can you post a link to the website?
    Contao Community Moderator
    → Support options

  9. #9
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    BTW: You are using an old .htaccess file. (.htaccess for Contao 3.5: https://pastebin.com/eC1YCESg)
    So basically your RewriteRule block should look like this:
    Code:
      RewriteCond %{REQUEST_FILENAME} !\.(htm|php|js|css|map|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff2?|svgz?|pdf|zip|gz)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule .* index.php [L]
    Contao Community Moderator
    → Support options

  10. #10
    New user
    Join Date
    04-15-18.
    Posts
    7

    Beitrag

    I've updated my .htaccess to that from your pastebin and it's still not loading assets.

    Link to site: removed

    Although I don't know how much it will help you, cause Disable page alias usage is checked, as site has to be working.
    Last edited by markuss; 04/16/2018 at 19:25.

  11. #11
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,100

    Default

    The best thing would be to provide a complete copy of the website under a subdomain where you can test it.
    Contao Community Moderator
    → Support options

  12. #12
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    484

    Default

    Try using the original fe_page template. The BASE tag is missing in your HEAD section.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  13. #13
    New user
    Join Date
    04-15-18.
    Posts
    7

    Beitrag

    Great, setting to the original fe_page template worked.

    Thank you both for your help!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •