skip to Main Content

I would like to change the path of the website from http://localhost/en-in/pan
to http://localhost/en-in/individual/pan

without creating a folder individual.

Kindly let me know if there is anything.

Following is the .htaccess file

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 
RewriteRule ^(.*)index$ /$1 [R=301,L] 

RewriteEngine On example.com

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]



ErrorDocument 404 https://www.example.com/404
ErrorDocument 500 https://www.example.com/404
# or map them to one error document:
# ErrorDocument 404 /pages/errors/error_redirect.php

RewriteEngine On
RewriteBase /en-us

RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /pages/errors/404.php [L]

# or map them to one error document:
#RewriteCond %{REQUEST_URI} ^/404/$ 

2

Answers


  1. It depends on the server you are running on.
    On apache, this can be achieved by creating a .htaccess file on your root directory of the website and add there the Redirect command:

    Redirect /en-in/pan /en-in/individual/pan
    
    Login or Signup to reply.
  2. Create a .htaccess file under your base directory (public_html or www) and put the content:

    RewriteEngine On #remove this line if it doesn't work
    RewriteRule en-in/individual/pan(/?)$ en-in/pan [QSA,L]
    

    Then you can redirect your traffic from active link to the new link

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search