V
V
Vlad2016-12-09 15:10:30
HTML
Vlad, 2016-12-09 15:10:30

How to write a 301 redirect in htaccess?

I need to make 2 redirects:
1) from all pages that end with .html# to .html
2) similarly with .html? on .html
Not working:

RewriteRule ^(.*)\.html?$ /$1.html [R=301,L]
RewriteRule ^(.*)\.html#$ /$1.html [R=301,L]

Help me please.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita Kit, 2016-12-09
@ShadowOfCasper

And zakovyt .html# and .html? tried? The question in the regular season is also a special character, hence the cant. I believe. I'm not an Apache expert.

A
Alexander, 2016-12-09
@zkelo

Maybe so?
^(.*)\.html(\?|\#)$ [R=301,L]

D
Dmitry Khristoev, 2016-12-09
@Haoss

seoprofy.ua/wp-content/uploads/2014/09/301-redirec...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question