我需要通过HTACCES文件将我的网站链接从https://ravisah.in/index.php重定向到ravisah.in

时间:2016-05-06 03:18:40

标签: php .htaccess

我希望我的网站将以下所有内容重定向到ravisah.in

  1. https://www.ravisah.in/index.php
  2. www.ravisah.in
  3. www.ravisah.in/index.php
  4. ravisah.in/index.php
  5. 请帮我这样做。

    我的htaccess文件代码

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^ravisah.in[nc]
    RewriteRule ^(.*)$ http://www.ravisah.in/$1 [r=301,nc]
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php
    
    ErrorDocument 404 /404.php
    

3 个答案:

答案 0 :(得分:1)

您可以使用以下规则:

RewriteRule ^index\.php$ / [R=301,L]

这会将 /index.php 永久重定向到 /

答案 1 :(得分:0)

我认为没有任何解决方案我只需要为网站购买SSL证书。

答案 2 :(得分:0)

使用.htaccess文件进行301重定向

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

RewriteCond %{HTTP_HOST} ^https://www.ravisah.in/index.php [NC]
RewriteRule ^(.*)$ http://ravisah.in/$1 [L,R=301]

**Used for remove www from url**
RewriteCond %{HTTP_HOST} ^www.ravisah.in [NC]
RewriteRule ^(.*)$ http://ravisah.in/$1 [L,R=301]

**Used for https to http**
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

**Used for remove index.php** 
RewriteRule ^index\.php$ / [R=301,L]

对于SSl工具您必须具有SSl证书