Htaccess Redirect Generator

खोज इंजिन अनुकूलन

Htaccess रिडायरेक्ट जेनरेटर


1. पुनर्निर्देशित प्रकार का चयन करें





2. अपना डोमेन नाम दर्ज करें


www। शामिल न करें। डोमेन नाम केवल - जैसे yourdomain.com

3. अपना कोड प्राप्त करें


4. कोड को अपनी .htaccess फ़ाइल में कॉपी करें



के बारे में Htaccess रिडायरेक्ट जेनरेटर

Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.

NOTE: The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view .htaccess files by default. Once uploaded to the server you can rename the file to .htaccess.

Question's and Answer's

301 (Permanent) Redirect:

Use a 301 redirect .htaccess to point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "itsite.org" domain.

When adding the following to your website's .htaccess file, be sure to replace itsite.org with your own domain name.

# This allows you to redirect your entire website to any other domain
    Redirect 301 / http://itsite.org/

302 (Temporary) Redirect:

Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:

      # This allows you to redirect your entire website to any other domain
      Redirect 302 / http://itsite.org/

Redirect index.html to a specific subfolder:

# This allows you to redirect index.html to a specific subfolder
            Redirect /index.html http://itsite.org/newdirectory/

Redirect an old directory to a new directory:

# Redirects itsite.org/old to itsite.org/new
            RewriteRule ^old/(.*)$ /new/$1 [R=301,NC,L]

Redirect to a subfolder with URL masking:

# Show the content in itsite.org/folder2, but the URL appears as itsite.org/folder1
              RewriteEngine On
              RewriteRule ^folder1/?$ /folder2/
# To show the URL as just itsite.org
              RewriteEngine On
              RewriteRule ^/?$ /folder2/

Redirect a non-existing page to index.php
Instead of prompting a 404 Not Found error page, the site will redirect to the homepage:

# Redirect non-existing pages to index.php
  Options +SymLinksIfOwnerMatch 
  RewriteEngine On 
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

Redirect an old file to a new file path:

# Redirect old file path to new file path
  Redirect /olddirectory/oldfile.html http://itsite.org/newdirectory/newfile.html

Redirect to a specific index page:

    # Provide Specific Index Page (Set the default handler)
        DirectoryIndex index.html

redirect non www to www:

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

redirect www to non www:

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

Redirect an error message:
Instead of prompting a 404 Not Found error page, the site will redirect to the homepage:

# Redirect 404 Error pages to the home page
                ErrorDocument 404 http://itsite.org/