Transform these Web.config rules into . htaccess

Asked

Viewed 105 times

0

Good night,

I’m needing to move these parts from a web.config to . htaccess, but I’m having a lot of questions.

<rule name="Regla 1-1">
              <match url="^camera/pictures/(.*)_small\.png$" ignoreCase="false" />
              <action type="Rewrite" url="camera/pictures/{R:1}.png" />
            </rule> 
            <rule name="Regla 2-2">
              <match url="^camera/thumbnails/(.*)\.png$" ignoreCase="false" />
              <action type="Rewrite" url="camera/thumbnails/{R:1}.png" />
            </rule>

Can someone help me?

Thank you!

  • What makes the second rule? Rewrite to the same URL???

  • As I understand it, it is. The most important is the first... When I rewrite, it doesn’t work.

1 answer

0

There’s almost no need to explain.

RewriteEngine on

RewriteRule ^camera/pictures/(.*)_small\.png$ /camera/pictures/$1.png

The second rule rewrites to the same URL. No need.

  • Only the bar / before the camera this "partially wrong" /camera/pictures/$1.png, just change into this camera/pictures/$1.png, that the answer seems correct to me ;)

  • @Guilhermenascimento Eu had So I modified it to treat it like a file-system path as a first option, in the same way as <rules> work in relation to the location of Web.config.

  • 'Cause there’s the question of RewriteBase, then I’ll test and confirm, just to be sure, but I remember this might cause some trouble.

  • @Guillhermenascimento may cause some problem with VirtualHosts, with a DocumentRoot different. It is true that it is recommended without the /, but the answer mimics the behavior of <rule>s.

  • I understand, I will test here as soon as possible, I have IIS and Apache2.4 installed and I warn you ;)

  • Thank you. I am also interested to know if there are exceptions.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.