Add bar at end of URL with Htaccess

Asked

Viewed 526 times

9

I’m having a problem with my .htaccess, because I used to use .htm at the end now that I want to bar can not change.

End use .htm query string:

##### Url Dinamica ###################################
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d

# Exibe a pagina com a extensao em .htm
RewriteRule ^([A-Za-z-]+)\.htm$ index.php?tag=$1 [qsappend]

</ifModule>

I tried to use

RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
RewriteRule ^([A-Za-z-]+)\$ index.php?tag=$1/ [qsappend]

But generates error and does not open normal

  • Good afternoon, which error is generated?

  • It’s going to 404

  • Ever tried to put nothing? Without the bar, only the ([A-Za-z-]+)$

1 answer

1

Try with that regex ^([A-Za-z-]+)\\\.htm$.

\\ to verify \ literal (case sensitive) and \. to verify . literal (case sensitive)

Browser other questions tagged

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