How to remove .html off the request url?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cruisey
    Member
    • Apr 2018
    • 53
    • 4.2.x

    [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 12 Sep '18, 12:10am.
  • Wayne Luke
    vBulletin Technical Support Lead
    • Aug 2000
    • 74161

    #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 demonstration site.
    vBulletin 5 API

    Comment

    • m-d-luffy
      Senior Member
      • Sep 2018
      • 109

      #3
      Originally posted by Cruisey
      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?
      العاب
      game
      ويب
      web

      https://www.youtube.com/@abdur7maan

      Comment

      • Cruisey
        Member
        • Apr 2018
        • 53
        • 4.2.x

        #4
        Originally posted by Wayne Luke
        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

        • Cruisey
          Member
          • Apr 2018
          • 53
          • 4.2.x

          #5
          Originally posted by m-d-luffy

          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

          • m-d-luffy
            Senior Member
            • Sep 2018
            • 109

            #6
            Originally posted by Cruisey

            Some just has the .html attached to it. We used to use vbseo
            What version are you currently using?
            العاب
            game
            ويب
            web

            https://www.youtube.com/@abdur7maan

            Comment

            • Cruisey
              Member
              • Apr 2018
              • 53
              • 4.2.x

              #7
              Originally posted by m-d-luffy

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

              Comment

              • m-d-luffy
                Senior Member
                • Sep 2018
                • 109

                #8
                Originally posted by Cruisey

                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]
                العاب
                game
                ويب
                web

                https://www.youtube.com/@abdur7maan

                Comment

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