0

There are 2 different URLs https://maldivesresorts.com.au/package/vakarufalhi-island-resort-all-meals-drinks/ and https://maldivesresorts.com.au/package/vakarufalhi-island-resort-all-meals-drinks/ but while SEO audit I found the wrong url and it is showing like https://maldivesresorts.com.au/luxury-resorts-study-vakarufalhi-maldives-resort/,https://maldivesresorts.com.au/package/vakarufalhi-island-resort-all-meals-drinks/,here so I want to redirect the wrong url to another page. So it should be redirect to /hot-deals.

Here is my htaccess code but it doesn't seems working

RewriteEngine On
redirect /luxury-resorts-study-vakarufalhi-maldives-resort/,https://maldivesresorts.com.au/package/vakarufalhi-island-resort-all-meals-drinks/,here /hot-deals
Vijay
  • 319
  • 2
  • 8
  • The example doesn't contain spaces but the `.htaccess` contains spaces, is it a typo? Did you try to use quotes around the path? – A.L Sep 30 '22 at 09:14
  • no, its not the answer and yes there is typo – Vijay Sep 30 '22 at 09:20
  • "There are 2 different URLs" - those 2 URLs are identical? Have you corrected the malformed link that is causing this error? What other directives do you have in your `.htaccess` file? – MrWhite Sep 30 '22 at 14:28

1 Answers1

0

This is how redirects work:

enter image description here

ref: https://www.semrush.com/blog/htaccess-redirect/

So you should be doing:

RewriteEngine On 
redirect 301 /luxury-resorts-study-vakarufalhi-maldives-resort/ /hot-deals 
redirect 301 /package/vakarufalhi-island-resort-all-meals-drinks/ /hot-deals

However, you look like you're redirecting folders rather than files so you should simply look at this question which your question appears to be a duplicate of.

Martin
  • 22,212
  • 11
  • 70
  • 132
  • Thanks for the answering but its a completely single url not multiple – Vijay Sep 30 '22 at 09:16
  • @Vijay the URLs in your example are folders (they end in `/`). Please **edit** and update your question. – Martin Sep 30 '22 at 09:17
  • no these are not folder's path, its complete url which have category/tag sort of – Vijay Sep 30 '22 at 09:23
  • @Vijay you are telling the system to redirect `/luxury-resorts-study-vakarufalhi-maldives-resort/` which is a folder path, even if it isn't a *real* folder path, that's what it looks like and you've done nothing to highlight or show any **Mod_Rewriting** you may be doing so we have no reason to think it's anything other than a folder path. Again, please can you **edit** and **clarify** your question. – Martin Sep 30 '22 at 09:30
  • @Vijay and does your htaccess currently have mod_rewrite operating? – Martin Sep 30 '22 at 09:46
  • yes, other redirects are working correctly – Vijay Sep 30 '22 at 09:48
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/248469/discussion-between-vijay-and-martin). – Vijay Sep 30 '22 at 12:22
  • _Aside:_ `Redirect` is a mod_alias directive. This has nothing to do with `RewriteEngine` (mod_rewrite). – MrWhite Sep 30 '22 at 14:30