Announcement

Collapse
No announcement yet.

How to remove .html off the request url?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Resolved] How to remove .html off the request url?

    Since upgraded from vb4 to vb5, most users has an old url with a .html at the end. I need to remove that before it called the routing.php. How to achieve this? I tried to add this in the .htaccess file:

    Code:
        # Main Redirect
        RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME}.html -f # This is what I've added
        RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
    Restarting apache does nothing. The issue is, the page redirects when I added the .html. I need it not to redirect.
    Last edited by Cruisey; Wed 12th Sep '18, 12:10am.

  • #2
    If you don't want it to redirect, you shouldn't at a redirect rule to do that.

    You should be able to access existing pages in the same directory as index.php just using their name. So if you add a file named file.html to the directory, it will still load. In other words, you shouldn't have to make any changes to the .htaccess file to access *.html files in the same directory as vBulletin.

    If you really want to bypass the redirect, you need to edit this line:
    Code:
     
    RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$
    So it looks like this:
    Code:
    RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css|html)$
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud customization and demonstration site.
    vBulletin 5 Documentation - Updated every Friday. Report issues here.
    vBulletin 5 API - Full / Mobile
    I am not currently available for vB Messenger Chats.

    Comment


    • #3
      Originally posted by Cruisey View Post
      Since upgraded from vb4 to vb4, most users has an old url with a .html at the end. I need to remove that before it called the routing.php. How to achieve this? I tried to add this in the .htaccess file:

      Code:
      # Main Redirect
      RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME}.html -f # This is what I've added
      RewriteRule ^(.*)$ index.php?routestring=$1 [L,QSA]
      Restarting apache does nothing. The issue is, the page redirects when I added the .html. I need it not to redirect.
      What is the format of your current or old links?

      How do you want to be new links?
      انمي - anime
      https://www.anime-toon.net/

      Comment


      • #4
        Originally posted by Wayne Luke View Post
        If you don't want it to redirect, you shouldn't at a redirect rule to do that.

        You should be able to access existing pages in the same directory as index.php just using their name. So if you add a file named file.html to the directory, it will still load. In other words, you shouldn't have to make any changes to the .htaccess file to access *.html files in the same directory as vBulletin.

        If you really want to bypass the redirect, you need to edit this line:
        Code:
        RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css)$
        So it looks like this:
        Code:
        RewriteCond %{REQUEST_URI} !\.(gif|jpg|jpeg|png|css|html)$
        Thanks!

        Comment


        • #5
          Originally posted by m-d-luffy View Post

          What is the format of your current or old links?

          How do you want to be new links?
          Some just has the .html attached to it. We used to use vbseo

          Comment


          • #6
            Originally posted by Cruisey View Post

            Some just has the .html attached to it. We used to use vbseo
            What version are you currently using?
            انمي - anime
            https://www.anime-toon.net/

            Comment


            • #7
              Originally posted by m-d-luffy View Post

              What version are you currently using?
              5.4.3. Ive managed to resolve the issue inside the routing.php

              Comment


              • #8
                Originally posted by Cruisey View Post

                5.4.3. Ive managed to resolve the issue inside the routing.php
                I use this code to convert old links to vbseo :
                RewriteRule ^t(.*)/$ https://sa-ar.anime-toons.tv/showthread.php?t=$1 [L,R=301]
                RewriteRule ^f(.*)/$ https://sa-ar.anime-toons.tv/forumdisplay.php?f=$1 [L,R=301]
                انمي - anime
                https://www.anime-toon.net/

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                X