Expand my Community achievements bar.

SOLVED

Best approach to remove appending " /"

Avatar

Level 5

Hi All,

When we tried to hit the URL with appending - '/' like:- http://<>*.mp4/ for the first time, request goes to the CQ and gives the error, but in this process dispatcher is creating folder with *.mp4. and as usual next subsequent requests will give errors as it tries to fetch from the cache.

What would be best approaches:-

1, like adding a rule in dispatcher like:- this worked for me.

/0046 { /type "deny" /glob "GET *.mp4/*" }

2, Adding a rewrite rule on the apache. it also worked but i it is creating issue some times.

RewriteRule ^(/.*\.(png|gif|jpg|mp4))/$ $1

 

Thanks,

viki

1 Accepted Solution

Avatar

Correct answer by
Level 10

Mahesh Vikram wrote...

Hi All,

When we tried to hit the URL with appending - '/' like:- http://<>*.mp4/ for the first time, request goes to the CQ and gives the error, but in this process dispatcher is creating folder with *.mp4. and as usual next subsequent requests will give errors as it tries to fetch from the cache.

What would be best approaches:-

1, like adding a rule in dispatcher like:- this worked for me.

/0046 { /type "deny" /glob "GET *.mp4/*" }

2, Adding a rewrite rule on the apache. it also worked but i it is creating issue some times.

RewriteRule ^(/.*\.(png|gif|jpg|mp4))/$ $1

 

Thanks,

viki

 

Change your second rule like which will work for all file type without any problem

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^(.*)/$ /$1 [L,R=301]

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Mahesh Vikram wrote...

Hi All,

When we tried to hit the URL with appending - '/' like:- http://<>*.mp4/ for the first time, request goes to the CQ and gives the error, but in this process dispatcher is creating folder with *.mp4. and as usual next subsequent requests will give errors as it tries to fetch from the cache.

What would be best approaches:-

1, like adding a rule in dispatcher like:- this worked for me.

/0046 { /type "deny" /glob "GET *.mp4/*" }

2, Adding a rewrite rule on the apache. it also worked but i it is creating issue some times.

RewriteRule ^(/.*\.(png|gif|jpg|mp4))/$ $1

 

Thanks,

viki

 

Change your second rule like which will work for all file type without any problem

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^(.*)/$ /$1 [L,R=301]