How to remove index through . htaccess file from site?

Asked

Viewed 1,723 times

0

Hello, I am making a site and I would like to remove the index by changing to another address ex: site.com.br/Uritiba - WITHOUT USING REDIRECTION IN CPANEL.

I am looking for a solution in . HTACCESS to re-name the index... but continuing to access the site through the MAIN URL - REMOVE INDEX BY . HTACCESS IS POSSIBLE?

  • 1

    You want to remove index.php from the url?

2 answers

0

Below you redirect your domain to a subfolder from index.php:

#Redireciona seu site pra uma sub pasta do domímio

Redirect /index.php http://www.site.com.br/curitiba

If you add the code below, you will rewrite all your Urls from index.php:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        # Remove index.php das URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
        # redireciona suas páginas a partir  de index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

0

The correct way to do this is by passing all the relevance of the index to your target page (Uritiba), if you just do a raw redirect, you will lose all relevance in the Serps (google, Bing, yahoo, Yandex, among others).

The correct way to redirect is also to inform that one should take all the relavância assigned by the search engines to your new landing page.

For that use the http status 301:

Rewritecond %{THE_REQUEST} .*/index.php

Rewriterule (.*)index.php$ /$1 [L,R=301]

Rewriterule /$ /Curitiba [L,R=301]

  • "passing all the relevance of the index to your landing page". Can you explain this part? I didn’t understand.

  • 1

    I can, if you do a redirect without passing the 301 status code (HTTP Status), stating that it is a permanent redirect, the search engines (google, yahoo among others) simply do not pass the relevance assigned to the page to the new destination url. This would cause loss of serp index positions; that is, loss of visit. In the above example I redirect by passing a 301 status code, it means permanent redirection, so the relevance assigned to the page and placement it has in the search engines remains.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.