Reputation: 351
I have a website and there is a booking page , booking.php
. I want to redirect people who is typing dot(.) at the end of url to correct url .
For example some one type example.com/booking.php.
then I have to redirect to example.com/booking.php
How can I do this?
I tried and it is not working
Redirect 301 http://www.example.com/appointment.php. http://www.example.com/appointment.php
Upvotes: 1
Views: 536
Reputation: 1633
You can use RedirectMatch
for that.
Check this code :
RedirectMatch 301 /appointment\.php\.$ /appointment.php
Reference : https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectmatch
OR
You can use mod_rewrite
to redirect it.
Check below code :
RewriteRule ^(.+)\.php\.$ $1.php [R=301,QSA,L]
Reference : http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule
Upvotes: 1