Re: Help with mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The best way to tackle this complex set of rules is to use your development server, clone the directives, comment out everything and uncomment a few rules at a time.

While you do this, see if you still have a loop (test with curl, not a browser), examine the log entries, and then uncomment another rule. Repeat until the loop appears.

If you have a specific question about one log entry, do ask it.

On Thu, Apr 20, 2023 at 2:18 AM Marc Serra <mserra@xxxxxxxxx> wrote:
Thank's for answer Frank,

A simple https://www.domain.tld/gb/ query generates a thousand lines
log file (attached). I'm really lost, I dont' know what I'm looking
for in the log file.



Missatge de Frank Gingras <thumbs@xxxxxxxxxx> del dia dc., 19 d’abr.
2023 a les 20:19:
>
> I would start with the rewrite log in your development environment, if you can't change the configuration on the live server.
>
> I would also look to replace this entire mess with a FallbackResource directive.
>
> On Tue, Apr 18, 2023 at 6:32 AM Marc Serra <mserra@xxxxxxxxx> wrote:
>>
>> Hi,
>>
>> A few weeks ago we renewed our prestashop website.
>>
>> One of the new features is the support for multiple languages.
>>
>> A typical home URL are...
>> https://www.domain.tld/gb/ for english
>> https://www.domain.tld/es/ for spanish
>> etc.
>>
>> A typical product URL are...
>> https://www.domain.tld/gb/PRODUCT_CATEGORY_FRIENDLY_URL/PRODUCT_CODE-PRODUCT_URL_FRIENDLY_DESCRIPTION.html
>> for english
>> https://www.domain.tld/es/PRODUCT_CATEGORY_FRIENDLY_URL/PRODUCT_CODE-PRODUCT_URL_FRIENDLY_DESCRIPTION.html
>> for spanish
>> etc.
>>
>> Our old URL wasn't contain the language, for example:
>> https://www.domain.tld/.html for home
>> https://www.domain.tld/PRODUCT_CATEGORY_FRIENDLY_URL/PRODUCT_CODE-PRODUCT_URL_FRIENDLY_DESCRIPTION.html
>> for product
>> etc.
>>
>> I'm trying to save the old URL and move to our default language (gb
>> for example).
>>
>> For start, I added the following two lines at the beginning of the
>> htaccess file. I try to redirect any URL not starting with /gb/ to the
>> english home page instead of 404 page ...
>>
>> RewriteCond %{REQUEST_URI} !^/gb/
>> RewriteRule ^.*$ /gb/ [L]
>>
>> # Followed by the prestashop default rules ...
>>
>> RewriteRule . - [E=REWRITEBASE:/]
>> RewriteRule ^api(?:/(.*))?$
>> %{ENV:REWRITEBASE}webservice/dispatcher.php?url="" [QSA,L]
>>
>> # Images
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg
>> [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
>> RewriteCond %{HTTP_HOST} ^www.domain.tld$
>> RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$
>> %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
>> # AlphaImageLoader for IE and fancybox
>> RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$
>> js/jquery/plugins/fancybox/images/$1.$2 [L]
>>
>> # Dispatcher
>> RewriteCond %{REQUEST_FILENAME} -s [OR]
>> RewriteCond %{REQUEST_FILENAME} -l [OR]
>> RewriteCond %{REQUEST_FILENAME} -d
>> RewriteRule ^.*$ - [NC,L]
>> RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
>>
>>
>>
>> But when I visit https://www.domain.tld/sdfsdf/, an internal server
>> errors appears. In apache error log:
>>
>> [Tue Apr 18 12:28:43.520237 2023] [core:error] [pid 521174:tid
>> 140459917698624] [client 90.x.x.x:47218] AH00124: Request exceeded the
>> limit of 10 internal redirects due to probable configuration error.
>> Use 'LimitInternalRecursion' t
>> o increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
>> [Tue Apr 18 12:28:43.520326 2023] [core:error] [pid 521174:tid
>> 140459917698624] [client 90.x.x.x:47218] AH00124: Request exceeded the
>> limit of 10 internal redirects due to probable configuration error.
>> Use 'LimitInternalRecursion' t
>> o increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
>>
>> If I visit https://www.domain.tld/gb/, an internal server errors
>> appears. In apache error log (the same):
>>
>> [Tue Apr 18 12:28:03.961530 2023] [core:error] [pid 521174:tid
>> 140460882368064] [client 90.x.x.x:37092] AH00124: Request exceeded the
>> limit of 10 internal redirects due to probable configuration error.
>> Use 'LimitInternalRecursion' t
>> o increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
>> [Tue Apr 18 12:28:03.961606 2023] [core:error] [pid 521174:tid
>> 140460882368064] [client 90.x.x.x:37092] AH00124: Request exceeded the
>> limit of 10 internal redirects due to probable configuration error.
>> Use 'LimitInternalRecursion' t
>> o increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
>>
>> Can anyone help me?
>>
>> Thank's
>>
>> --
>> Marc Serra
>>
>> --
>>
>>
>>
>>
>>
>>       <https://www.manxa.com>
>>
>>      Manxa 1876, S.L.
>> Ctra. Les
>> Tries, 85.17800 Olot (Girona)
>> *Tel. 972 27 45 30 www.manxa.com
>> <https://www.manxa.com>*
>>
>>      <https://www.manxaindustrial.com> *Manxa
>> Industrial <https://www.manxaindustrial.com>*
>>
>> <https://www.manxaferros.com>  *Manxa Ferros <https://www.manxaferros.com>*
>>  <https://www.manxabricolatge.com>  *Manxa Ferreteria i Parament de la Llar
>> <https://www.manxabricolatge.com>*
>>
>>
>>
>>
>>
>>
>>
>> --
>>  <https://www.manxaferros.com/ca/content/217-videos-corporatius>
>>
>> --
>>
>>
>> El contingut d’aquest correu electrònic i els seus annexos és
>> estrictament confidencial. En el cas que no siguis el destinatari i hagis
>> rebut aquest missatge per error, preguem que ho comuniquis al remitent i
>> procedeixis a la seva eliminació, sense difondre, emmagatzemar o copiar el
>> seu contingut. Imprimeix aquest correu només si és necessari.
>>
>> El contenido
>> de este correo electrónico y sus anexos es estrictamente confidencial. En
>> el caso de que no seas el destinatario y hayas recibido este mensaje por
>> error, rogamos lo comuniques al remitente y procedas a su eliminación, sin
>> difundir, almacenar o copiar su contenido. Imprimir este correo solo si es
>> necesario.
>>
>> The content of this email and its attachments is strictly
>> confidential. If you are not the recipient and you have received this
>> message by mistake, please notify the sender and proceed to its
>> elimination, without spreading, storing or copying its content. Print this
>> email only if necessary.
>>
>> Le contenu de cet e-mail et de ses pièces jointes
>> est strictement confidentiel. Dans le cas où vous n'êtes pas le
>> destinataire et avez reçu ce message par erreur, veuillez en informer
>> l'expéditeur et procéder à sa suppression, sans diffuser, stocker ou copier
>> son contenu. Imprimez cet e-mail uniquement si nécessaire.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>>


--
Marc Serra

--





      <https://www.manxa.com>

     Manxa 1876, S.L.
Ctra. Les
Tries, 85.17800 Olot (Girona)
*Tel. 972 27 45 30 www.manxa.com
<https://www.manxa.com>*

     <https://www.manxaindustrial.com> *Manxa
Industrial <https://www.manxaindustrial.com>*

<https://www.manxaferros.com>  *Manxa Ferros <https://www.manxaferros.com>*
 <https://www.manxabricolatge.com>  *Manxa Ferreteria i Parament de la Llar
<https://www.manxabricolatge.com>*







--
 <https://www.manxaferros.com/ca/content/217-videos-corporatius>

--


El contingut d’aquest correu electrònic i els seus annexos és
estrictament confidencial. En el cas que no siguis el destinatari i hagis
rebut aquest missatge per error, preguem que ho comuniquis al remitent i
procedeixis a la seva eliminació, sense difondre, emmagatzemar o copiar el
seu contingut. Imprimeix aquest correu només si és necessari.

El contenido
de este correo electrónico y sus anexos es estrictamente confidencial. En
el caso de que no seas el destinatario y hayas recibido este mensaje por
error, rogamos lo comuniques al remitente y procedas a su eliminación, sin
difundir, almacenar o copiar su contenido. Imprimir este correo solo si es
necesario.

The content of this email and its attachments is strictly
confidential. If you are not the recipient and you have received this
message by mistake, please notify the sender and proceed to its
elimination, without spreading, storing or copying its content. Print this
email only if necessary.

Le contenu de cet e-mail et de ses pièces jointes
est strictement confidentiel. Dans le cas où vous n'êtes pas le
destinataire et avez reçu ce message par erreur, veuillez en informer
l'expéditeur et procéder à sa suppression, sans diffuser, stocker ou copier
son contenu. Imprimez cet e-mail uniquement si nécessaire.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux