1

I want to redirect

  1. https://example.com/index.php to https://example.com

  2. https://example.com/view/india.php to https://example.com/india

  3. https://example.com/view/city/india/chennai.php to https://example.com/india/chennai

This is what I want to achieve anyone please send me the .htaccess code for this problem.

MrWhite
  • 43,179
  • 8
  • 60
  • 84
Manoj S
  • 11
  • 2
  • Have a look here : https://stackoverflow.com/questions/18973058/how-to-remove-folder-name-from-url-using-htaccess It describes how to remove a folder name from an url using .htaccess – Finalmix6 Jan 02 '22 at 18:44
  • I am new to .htaccess I tried to understand but can't I need the .htaccess code the questions I have asked. – Manoj S Jan 02 '22 at 18:47
  • Does your site know how to handle URLs of the form `/india` and `/india/chennai`? (Otherwise you need to do more than simply "redirect" the request.) What URLs are you currently linking to in your application? What do you currently have in your `.htaccess` file? – MrWhite May 01 '23 at 23:13

1 Answers1

0

You'll be using

RewriteEngine  on
RewriteRule ^(.*)$ $1.php