Joomla / htaccess: перенаправить index.php? Start = [0-9] в / без прерывания нумерации страниц в других местах - PullRequest
0 голосов
/ 10 ноября 2018

Я бы хотел перенаправить нумерацию страниц моей домашней страницы Joomla с https://example.com/index.php?start=5 на корень (https://example.com/), не влияя на другие нумерации страниц на сайте (то есть: https://example.com/news.html?start=5 или https://example.com/categories.html?start=5).

Я могу перенаправить https://example.com/?start=5 на https://example.com/, не затрагивая остальную часть нумерации страниц по следующему правилу:

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

Однако я не могу перенаправить с включением index.php (https://example.com/index.php?start=5), не влияя на остальную часть нумерации страниц сайта. Я пробовал со следующим правилом:

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

, но это влияет на остальную часть нумерации страниц, как https://example.com/news.html?start=5 редирект на /.

Есть ли у вас идеи сделать такой вид перенаправления?

Вот мой настоящий .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}#%{HTTPS}s ^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]
#####################################################################
...