Dynamic friendly URL .htaccess

0

I currently have the following rule in .htaccess:

RewriteRule ^fale-conosco/?$ view/fale_conosco.php [NC,L]

And I'd like you to be able to enter a friendly URL after you contact us /.

Example:

fale-conosco/ajuda

For this I am using a regex but it is not working:

/^fale-conosco\/*([a-zA-Z0-9])*/g

I've tried a lot of regular expressions but so far nothing has worked.

When I tested the regexr I got an error when I added localhost in front of the rest of the URL, such as ignoring what's in front of fale-conosco/ ?

    
asked by anonymous 15.08.2018 / 21:52

1 answer

1

[EDIT]

Ignore before and pass by parameter: RewriteRule ^(.*)/fale-conosco/(.*)?$ view/fale_conosco.php?parametro=$2 [NC,L] .

I forgot to explain: the first (.*) takes anything before /fale-conosco (which is stored in $1 ), the second (.*) gets everything after /fale-conosco , which is $2 .

You can by RewriteRule ^fale-conosco/.*?$ view/fale_conosco.php [NC,L] . Everything after fale-conosco/ will be ignored.

I tested this site: link

    
15.08.2018 / 22:11