Joomla/htaccess : redirect index.php?start=[0-9] to / without breaking pagination elsewhere









up vote
0
down vote

favorite












I would like to redirect pagination of my Joomla homepage from https://example.com/index.php?start=5 to the root (https://example.com/) without impacting other pagination in website (ie: https://example.com/news.html?start=5 or https://example.com/categories.html?start=5).



I am able to redirect the https://example.com/?start=5 to https://example.com/ without impacting the rest of the pagination of the site with the following rule:



RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
RewriteRule ^$ https://example.com/$1? [R=301,L]


However it is impossible for me to redirect with the inclusion of index.php (https://example.com/index.php?start=5) without impacting the rest of the pagination of the site. I tried with the following rule:



RewriteCond %REQUEST_URI ^/index.php$
RewriteCond %QUERY_STRING ^start=(.*)$
RewriteRule ^index.php$ https://example.com/ [R=301,L]


but this impacts the rest of the pagination of the site like https://example.com/news.html?start=5 redirect to /.



Do you have any idea to do this kind of redirect ?



Here is my curent .htaccess :



IndexIgnore *

## Can be commented out if causes errors, see notes above.
Options +FollowSymlinks
Options -Indexes

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %QUERY_STRING base64_encode[^(]*([^)]*) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %QUERY_STRING (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %QUERY_STRING GLOBALS(=|[|%[0-9A-Z]0,2) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %QUERY_STRING _REQUEST(=|[|%[0-9A-Z]0,2)
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#

## Redirect index.php to https root ###############################
RewriteCond %THE_REQUEST !^POST
RewriteCond %THE_REQUEST ^[A-Z]3,9 /index.php HTTP/
RewriteCond %SERVER_PORT>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index.php$ https://%HTTP_HOST/ [R=301,L]
###################################################################
## End ############## Utiliser "http%2://" pour http & https ######

## Rewrite (http & https)
RewriteCond %HTTP_HOST#%HTTPSs ^www.([^#]+)#(?:off|on(s)) [NC]
RewriteRule ^ https://%1%REQUEST_URI [R=301,L]
###################################################################
## End ############## Utiliser "http%2://" pour http & https ######


RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
RewriteRule ^$ https://%HTTP_HOST/$1? [R=301,NE,NC,L]

# RewriteBase /

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%HTTP:Authorization]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %REQUEST_URI !^/index.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %REQUEST_FILENAME !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %REQUEST_FILENAME !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - core SEF Section.

## FORCE HTTPS ######################################################
RewriteCond %HTTPS OFF
RewriteRule (.*) https://%HTTP_HOST%REQUEST_URI [R=301,L]
#####################################################################









share|improve this question

























    up vote
    0
    down vote

    favorite












    I would like to redirect pagination of my Joomla homepage from https://example.com/index.php?start=5 to the root (https://example.com/) without impacting other pagination in website (ie: https://example.com/news.html?start=5 or https://example.com/categories.html?start=5).



    I am able to redirect the https://example.com/?start=5 to https://example.com/ without impacting the rest of the pagination of the site with the following rule:



    RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
    RewriteRule ^$ https://example.com/$1? [R=301,L]


    However it is impossible for me to redirect with the inclusion of index.php (https://example.com/index.php?start=5) without impacting the rest of the pagination of the site. I tried with the following rule:



    RewriteCond %REQUEST_URI ^/index.php$
    RewriteCond %QUERY_STRING ^start=(.*)$
    RewriteRule ^index.php$ https://example.com/ [R=301,L]


    but this impacts the rest of the pagination of the site like https://example.com/news.html?start=5 redirect to /.



    Do you have any idea to do this kind of redirect ?



    Here is my curent .htaccess :



    IndexIgnore *

    ## Can be commented out if causes errors, see notes above.
    Options +FollowSymlinks
    Options -Indexes

    ## Mod_rewrite in use.

    RewriteEngine On

    ## Begin - Rewrite rules to block out some common exploits.
    # If you experience problems on your site block out the operations listed below
    # This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    # Block out any script trying to base64_encode data within the URL.
    RewriteCond %QUERY_STRING base64_encode[^(]*([^)]*) [OR]
    # Block out any script that includes a <script> tag in URL.
    RewriteCond %QUERY_STRING (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL.
    RewriteCond %QUERY_STRING GLOBALS(=|[|%[0-9A-Z]0,2) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL.
    RewriteCond %QUERY_STRING _REQUEST(=|[|%[0-9A-Z]0,2)
    # Return 403 Forbidden header and show the content of the root homepage
    RewriteRule .* index.php [F]
    #
    ## End - Rewrite rules to block out some common exploits.

    ## Begin - Custom redirects
    #
    # If you need to redirect some pages, or set a canonical non-www to
    # www redirect (or vice versa), place that code here. Ensure those
    # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
    #

    ## Redirect index.php to https root ###############################
    RewriteCond %THE_REQUEST !^POST
    RewriteCond %THE_REQUEST ^[A-Z]3,9 /index.php HTTP/
    RewriteCond %SERVER_PORT>s ^(443>(s)|[0-9]+>s)$
    RewriteRule ^index.php$ https://%HTTP_HOST/ [R=301,L]
    ###################################################################
    ## End ############## Utiliser "http%2://" pour http & https ######

    ## Rewrite (http & https)
    RewriteCond %HTTP_HOST#%HTTPSs ^www.([^#]+)#(?:off|on(s)) [NC]
    RewriteRule ^ https://%1%REQUEST_URI [R=301,L]
    ###################################################################
    ## End ############## Utiliser "http%2://" pour http & https ######


    RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
    RewriteRule ^$ https://%HTTP_HOST/$1? [R=301,NE,NC,L]

    # RewriteBase /

    ## Begin - Joomla! core SEF Section.
    #
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%HTTP:Authorization]
    #
    # If the requested path and file is not /index.php and the request
    # has not already been internally rewritten to the index.php script
    RewriteCond %REQUEST_URI !^/index.php
    # and the requested path and file doesn't directly match a physical file
    RewriteCond %REQUEST_FILENAME !-f
    # and the requested path and file doesn't directly match a physical folder
    RewriteCond %REQUEST_FILENAME !-d
    # internally rewrite the request to the index.php script
    RewriteRule .* index.php [L]
    #
    ## End - core SEF Section.

    ## FORCE HTTPS ######################################################
    RewriteCond %HTTPS OFF
    RewriteRule (.*) https://%HTTP_HOST%REQUEST_URI [R=301,L]
    #####################################################################









    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I would like to redirect pagination of my Joomla homepage from https://example.com/index.php?start=5 to the root (https://example.com/) without impacting other pagination in website (ie: https://example.com/news.html?start=5 or https://example.com/categories.html?start=5).



      I am able to redirect the https://example.com/?start=5 to https://example.com/ without impacting the rest of the pagination of the site with the following rule:



      RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
      RewriteRule ^$ https://example.com/$1? [R=301,L]


      However it is impossible for me to redirect with the inclusion of index.php (https://example.com/index.php?start=5) without impacting the rest of the pagination of the site. I tried with the following rule:



      RewriteCond %REQUEST_URI ^/index.php$
      RewriteCond %QUERY_STRING ^start=(.*)$
      RewriteRule ^index.php$ https://example.com/ [R=301,L]


      but this impacts the rest of the pagination of the site like https://example.com/news.html?start=5 redirect to /.



      Do you have any idea to do this kind of redirect ?



      Here is my curent .htaccess :



      IndexIgnore *

      ## Can be commented out if causes errors, see notes above.
      Options +FollowSymlinks
      Options -Indexes

      ## Mod_rewrite in use.

      RewriteEngine On

      ## Begin - Rewrite rules to block out some common exploits.
      # If you experience problems on your site block out the operations listed below
      # This attempts to block the most common type of exploit `attempts` to Joomla!
      #
      # Block out any script trying to base64_encode data within the URL.
      RewriteCond %QUERY_STRING base64_encode[^(]*([^)]*) [OR]
      # Block out any script that includes a <script> tag in URL.
      RewriteCond %QUERY_STRING (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
      # Block out any script trying to set a PHP GLOBALS variable via URL.
      RewriteCond %QUERY_STRING GLOBALS(=|[|%[0-9A-Z]0,2) [OR]
      # Block out any script trying to modify a _REQUEST variable via URL.
      RewriteCond %QUERY_STRING _REQUEST(=|[|%[0-9A-Z]0,2)
      # Return 403 Forbidden header and show the content of the root homepage
      RewriteRule .* index.php [F]
      #
      ## End - Rewrite rules to block out some common exploits.

      ## Begin - Custom redirects
      #
      # If you need to redirect some pages, or set a canonical non-www to
      # www redirect (or vice versa), place that code here. Ensure those
      # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
      #

      ## Redirect index.php to https root ###############################
      RewriteCond %THE_REQUEST !^POST
      RewriteCond %THE_REQUEST ^[A-Z]3,9 /index.php HTTP/
      RewriteCond %SERVER_PORT>s ^(443>(s)|[0-9]+>s)$
      RewriteRule ^index.php$ https://%HTTP_HOST/ [R=301,L]
      ###################################################################
      ## End ############## Utiliser "http%2://" pour http & https ######

      ## Rewrite (http & https)
      RewriteCond %HTTP_HOST#%HTTPSs ^www.([^#]+)#(?:off|on(s)) [NC]
      RewriteRule ^ https://%1%REQUEST_URI [R=301,L]
      ###################################################################
      ## End ############## Utiliser "http%2://" pour http & https ######


      RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
      RewriteRule ^$ https://%HTTP_HOST/$1? [R=301,NE,NC,L]

      # RewriteBase /

      ## Begin - Joomla! core SEF Section.
      #
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%HTTP:Authorization]
      #
      # If the requested path and file is not /index.php and the request
      # has not already been internally rewritten to the index.php script
      RewriteCond %REQUEST_URI !^/index.php
      # and the requested path and file doesn't directly match a physical file
      RewriteCond %REQUEST_FILENAME !-f
      # and the requested path and file doesn't directly match a physical folder
      RewriteCond %REQUEST_FILENAME !-d
      # internally rewrite the request to the index.php script
      RewriteRule .* index.php [L]
      #
      ## End - core SEF Section.

      ## FORCE HTTPS ######################################################
      RewriteCond %HTTPS OFF
      RewriteRule (.*) https://%HTTP_HOST%REQUEST_URI [R=301,L]
      #####################################################################









      share|improve this question













      I would like to redirect pagination of my Joomla homepage from https://example.com/index.php?start=5 to the root (https://example.com/) without impacting other pagination in website (ie: https://example.com/news.html?start=5 or https://example.com/categories.html?start=5).



      I am able to redirect the https://example.com/?start=5 to https://example.com/ without impacting the rest of the pagination of the site with the following rule:



      RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
      RewriteRule ^$ https://example.com/$1? [R=301,L]


      However it is impossible for me to redirect with the inclusion of index.php (https://example.com/index.php?start=5) without impacting the rest of the pagination of the site. I tried with the following rule:



      RewriteCond %REQUEST_URI ^/index.php$
      RewriteCond %QUERY_STRING ^start=(.*)$
      RewriteRule ^index.php$ https://example.com/ [R=301,L]


      but this impacts the rest of the pagination of the site like https://example.com/news.html?start=5 redirect to /.



      Do you have any idea to do this kind of redirect ?



      Here is my curent .htaccess :



      IndexIgnore *

      ## Can be commented out if causes errors, see notes above.
      Options +FollowSymlinks
      Options -Indexes

      ## Mod_rewrite in use.

      RewriteEngine On

      ## Begin - Rewrite rules to block out some common exploits.
      # If you experience problems on your site block out the operations listed below
      # This attempts to block the most common type of exploit `attempts` to Joomla!
      #
      # Block out any script trying to base64_encode data within the URL.
      RewriteCond %QUERY_STRING base64_encode[^(]*([^)]*) [OR]
      # Block out any script that includes a <script> tag in URL.
      RewriteCond %QUERY_STRING (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
      # Block out any script trying to set a PHP GLOBALS variable via URL.
      RewriteCond %QUERY_STRING GLOBALS(=|[|%[0-9A-Z]0,2) [OR]
      # Block out any script trying to modify a _REQUEST variable via URL.
      RewriteCond %QUERY_STRING _REQUEST(=|[|%[0-9A-Z]0,2)
      # Return 403 Forbidden header and show the content of the root homepage
      RewriteRule .* index.php [F]
      #
      ## End - Rewrite rules to block out some common exploits.

      ## Begin - Custom redirects
      #
      # If you need to redirect some pages, or set a canonical non-www to
      # www redirect (or vice versa), place that code here. Ensure those
      # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
      #

      ## Redirect index.php to https root ###############################
      RewriteCond %THE_REQUEST !^POST
      RewriteCond %THE_REQUEST ^[A-Z]3,9 /index.php HTTP/
      RewriteCond %SERVER_PORT>s ^(443>(s)|[0-9]+>s)$
      RewriteRule ^index.php$ https://%HTTP_HOST/ [R=301,L]
      ###################################################################
      ## End ############## Utiliser "http%2://" pour http & https ######

      ## Rewrite (http & https)
      RewriteCond %HTTP_HOST#%HTTPSs ^www.([^#]+)#(?:off|on(s)) [NC]
      RewriteRule ^ https://%1%REQUEST_URI [R=301,L]
      ###################################################################
      ## End ############## Utiliser "http%2://" pour http & https ######


      RewriteCond %QUERY_STRING ^start=([0-9]*)$ [NC]
      RewriteRule ^$ https://%HTTP_HOST/$1? [R=301,NE,NC,L]

      # RewriteBase /

      ## Begin - Joomla! core SEF Section.
      #
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%HTTP:Authorization]
      #
      # If the requested path and file is not /index.php and the request
      # has not already been internally rewritten to the index.php script
      RewriteCond %REQUEST_URI !^/index.php
      # and the requested path and file doesn't directly match a physical file
      RewriteCond %REQUEST_FILENAME !-f
      # and the requested path and file doesn't directly match a physical folder
      RewriteCond %REQUEST_FILENAME !-d
      # internally rewrite the request to the index.php script
      RewriteRule .* index.php [L]
      #
      ## End - core SEF Section.

      ## FORCE HTTPS ######################################################
      RewriteCond %HTTPS OFF
      RewriteRule (.*) https://%HTTP_HOST%REQUEST_URI [R=301,L]
      #####################################################################






      apache .htaccess redirect mod-rewrite joomla






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 15:19









      fornever

      11




      11



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240353%2fjoomla-htaccess-redirect-index-phpstart-0-9-to-without-breaking-paginatio%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240353%2fjoomla-htaccess-redirect-index-phpstart-0-9-to-without-breaking-paginatio%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto