Best approach to remove appending " /" | Community
Skip to main content
Level 4
February 29, 2016
Solved

Best approach to remove appending " /"

  • February 29, 2016
  • 1 reply
  • 867 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Amit_Kumar

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]

1 reply

Amit_Kumar
Amit_KumarAccepted solution
Level 10
February 29, 2016

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]