.htaccess rewrite - filename.html a /? c = filename

0

SPANISH: Hello, I need it to work with all the html links (except with index), I tried using .htaccess but I had no luck.

For example ... to change this link of: link to link

Also if I go directly to link , it should be a mirror of link

Thank you very much!

ENGLISH: Hi, I need it to work with all html URLs (except index), I tried using .htaccess with no luck.

For example ... change this link from: link to link

Also if I enter directly to link , it must mirror link

Thanks a lot!

EDITED I managed to do it with this code: EDIT I managed to do it with this code:

Options +FollowSymLinks -MultiViews

RewriteEngine On

# Redirect from signup.html to /?c=signup
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ([^.]+)\.html$ ?c=$1 [R,L]

# Rewrite from /?c=signup to signup.html
RewriteCond %{QUERY_STRING} ^c=([^&]+)
RewriteRule ^/?$ %1.html [QSD,L]
    
asked by es2305 12.11.2018 в 06:41
source

1 answer

0

Use regular expressions. We define an atom , and then use it for its index. $1

For example, this rule would do what I understand you ask.

RewriteRule ^/?([a-zA-Z_]+).html$ ? c=$1 [L]
    
answered by 12.11.2018 в 07:15