Similar rewriterule problems in htaccess URL

Asked

Viewed 57 times

0

I have two Urls

http://localhost/odata/contact

http://localhost/odata/en

They are different URL that lead to different . php files, so I did my htaccess:

RewriteRule ^entre-em-contato entre-em-contato.php
RewriteRule ^en antigo-en.php

But both Urls are leading to the archive antigo-en.php

I tried to reverse it like I read in that post:

RewriteRule ^en antigo-en.php
RewriteRule ^entre-em-contato entre-em-contato.php

But you’re still both redirecting to antigo-en.php

What to do?

1 answer

1


Your rule is not correct, you should mark the beginning using the character (^) and the end of the expression ($) as below:

RewriteRule ^odata/entre-em-contato$ entre-em-contato.php [L]

The expression above translating in broad lines says, that the url it contains after the domain that in your case is localhost, odata preceded by get-in-touch Was forwarded to the file at the root get-in-touch.php

RewriteRule ^odata/en$               antigo-en.php        [L]

The url it contains odata preceded by en will be forwarded to the file at the root ancient-en.php

[L] is last, that is, in a list of conditions, the conditions below those with this flag will not be read.

Browser other questions tagged

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