Expand my Community achievements bar.

SOLVED

how to cache sling suffices on my dispatcher?

Avatar

Level 9

current setup:

  • I have this URL (www.my-host.com/people/first.last). this displays profile for the company staff.
  • first.last is a a suffix
  • When visiting this URL, this creates a cached file inside this path => /mnt/var/html/www/content/main/en/people.dir.html/first.last
  • These are the rules used to make this happen.

 

RewriteCond %{REQUEST_URI} ^/people(.html)?/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/content/main/en/people/(.*)$
RewriteRule /people(.html)?/(.*)$ /content/main/en/people.dir.html/$2 [PT,L]

 

 

new setup:

  • I have to replicate the technique used above for a new dynamic page.
  • The new page will be using this URL format (www.my-host.com/product2/name/year)
  • name and year are both suffixes. Year is optional
  • The URL would then fetch the content that's stored in /mnt/var/html/www/content/main/en/product2.dir.html/name.year
  • These are my rewrite lines that I'm testing

 

#FIRST
RewriteCond %{REQUEST_URI} ^/product1(.html)?/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/content/main/en/product1/(.*)$
RewriteRule /product1(.html)?/(.*)$ /content/main/en/product1.dir.html/$2 [PT,L]
LogLevel alert rewrite:trace6

#SECOND
RewriteCond %{REQUEST_URI} ^/product2(.html)?/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/content/main/en/product2/(.*)$
RewriteRule /product2(.html)?/([^/]*)/?(.*)$ /content/main/en/product2.dir.html/$2$3 [PT,L]
LogLevel alert rewrite:trace6

 

test results for #FIRST

  • With this rewrite lines, I get the the product1 content on my page but I do not get a file cached like in the current setup.
  • This is what I'm seeing in the Apache logs

 

[Mon Aug 23 03:29:26.339887 2021] [rewrite:trace2] [pid 26014:tid 139679642937088] mod_rewrite.c(470): [client 129.96.84.45:30376] 10.44.0.7 - - [www.my-host.com/sid#56216f42e620][rid#7f098c004980/initial] rewrite '/product1/name/name/2021' -> '/content/main/en/product1/name.dir.html/name/2021'
[Mon Aug 23 03:29:26.339894 2021] [rewrite:trace2] [pid 26014:tid 139679642937088] mod_rewrite.c(470): [client 129.96.84.45:30376] 10.44.0.7 - - [www.my-host.com/sid#56216f42e620][rid#7f098c004980/initial] forcing '/content/main/en/product1/name.dir.html/name/2021' to get passed through to next API URI-to-filename handler

 

test results for #SECOND

  • With this rewrite lines, I all I get is a blank page on my page and I do not get a file cached like in the current setup.
  • This is what I'm seeing in the Apache logs

 

[Mon Aug 23 03:25:48.119398 2021] [rewrite:trace2] [pid 26014:tid 139679483475712] mod_rewrite.c(470): [client 129.96.84.45:29840] 10.44.0.7 - - [www.my-host.com/sid#56216f42e620][rid#7f0984002970/initial] rewrite '/product2/name/2021' -> '/content/main/en/product2/name.dir.html/name2021'
[Mon Aug 23 03:25:48.119406 2021] [rewrite:trace2] [pid 26014:tid 139679483475712] mod_rewrite.c(470): [client 129.96.84.45:29840] 10.44.0.7 - - [www.my-host.com/sid#56216f42e620][rid#7f0984002970/initial] forcing '/content/main/en/product2/name.dir.html/name2021' to get passed through to next API URI-to-filename handler

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @jayv25585659 

   just to check why your first case have intial rewrite rule with two name i.e 

/product1/name/name/2021'

 

You have another rule for this?

Thanks

Dipti

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @jayv25585659 

   just to check why your first case have intial rewrite rule with two name i.e 

/product1/name/name/2021'

 

You have another rule for this?

Thanks

Dipti