MilesWeb
MilesWeb Hosting Forum

Please login or register.

Login with username, password and session length

 

News:

SMF - Just Installed!


Author Topic: How to resolve 301 Redirect issue?  (Read 17015 times)

0 Members and 1 Guest are viewing this topic.

Offline DipakS

  • Full Member
  • ***
  • Posts: 113
  • Karma: +0/-0
    • View Profile
How to resolve 301 Redirect issue?
« on: February 19, 2018, 04:42:46 PM »
Hello Everyone,

I need your help, I have added 301 to the main page and its working properly.
Example: from http://example.com to http://www.example.com

But as I apply the same method to my website inner pages I am facing some issues like it's not working properly and getting redirected to the home page with index.php
For example: If I load this link in my browser: http://www.example.com/test.html
It's redirecting me to http://example.com/index.php

I am not sure, what went wrong and why it is showing the index.php page at the end of my URL.

Please help me,

MilesWeb Hosting Forum

How to resolve 301 Redirect issue?
« on: February 19, 2018, 04:42:46 PM »

Offline Gandhar Kulkarni

  • Administrator
  • Full Member
  • *****
  • Posts: 176
  • Karma: +0/-0
    • View Profile
    • MilesWeb Internet Services Pvt. Ltd.
Re: How to resolve 301 Redirect issue?
« Reply #1 on: February 21, 2018, 12:23:22 PM »
Hello Everyone,

I need your help, I have added 301 to the main page and its working properly.
Example: from http://example.com to http://www.example.com

But as I apply the same method to my website inner pages I am facing some issues like it's not working properly and getting redirected to the home page with index.php
For example: If I load this link in my browser: http://www.example.com/test.html
It's redirecting me to http://example.com/index.php

I am not sure, what went wrong and why it is showing the index.php page at the end of my URL.

Please help me,

Try this one

Add following lines in your htaccess file.

RewriteEngine on
RewriteRule ^$ http://www.example.com/ [R=301,L]

replace example.com with different url (where you would like to redirect)


I hope it will work.
█MilesWeb - Your Hosting, Our Responsibility!
Unlimited Web Hosting @ ₹60/mo
VPS Hosting | WordPress Hosting | Reseller Hosting

Offline Anu

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
    • View Profile
Re: How to resolve 301 Redirect issue?
« Reply #2 on: February 21, 2018, 06:11:58 PM »
You need to consult the expert designer or hosting provider to sort such technical issues.

Offline Lokesh

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
Re: How to resolve 301 Redirect issue?
« Reply #3 on: February 23, 2018, 04:27:11 PM »
Hello Everyone,

I need your help, I have added 301 to the main page and its working properly.
Example: from http://example.com to http://www.example.com

But as I apply the same method to my website inner pages I am facing some issues like it's not working properly and getting redirected to the home page with index.php
For example: If I load this link in my browser: http://www.example.com/test.html
It's redirecting me to http://example.com/index.php

I am not sure, what went wrong and why it is showing the index.php page at the end of my URL.

Please help me,


In order to redirect /home and /index to the root and return all non www addresses to www, You can add the following to your .htaccess in the root of the /public folder,

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\."yoursite"\.com
RewriteRule (.*) http://www.example.com/ [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ http://www.. [R=301,L]

I hope it will work. :)

Offline EKTA TRIPATHI

  • Full Member
  • ***
  • Posts: 217
  • Karma: +1/-1
    • View Profile
    • MilesWeb Internet Service
Re: How to resolve 301 Redirect issue?
« Reply #4 on: February 24, 2018, 05:37:09 PM »
Hello Everyone,

I need your help, I have added 301 to the main page and its working properly.
Example: from http://example.com to http://www.example.com

But as I apply the same method to my website inner pages I am facing some issues like it's not working properly and getting redirected to the home page with index.php
For example: If I load this link in my browser: http://www.example.com/test.html
It's redirecting me to http://example.com/index.php

I am not sure, what went wrong and why it is showing the index.php page at the end of my URL.

Please help me,

Try this one

Add following lines in your htaccess file.

RewriteEngine on
RewriteRule ^$ http://www.example.com/ [R=301,L]

replace example.com with different url (where you would like to redirect)


I hope it will work.

Yes, you can use this method because I have clarified this issue by using the same method.
█ MilesWeb - Your Hosting, Our Responsibility!
█ Reseller Hosting @ ₹270/mo - Unlimited SSD Storage & Bandwidth | Reseller Control Panel
24x7 Support

Offline Ritu

  • Full Member
  • ***
  • Posts: 167
  • Karma: +1/-0
    • View Profile
Re: How to resolve 301 Redirect issue?
« Reply #5 on: February 27, 2018, 01:06:52 PM »
Alternative Methods to Implement a 301 Redirect
If you do not have access to your .htaccess file or your Windows Server Administration Panel, you can still perform 301 redirects with the code on your old pages.
If your website pages are in PHP, ASP, Java, or any other language that allows you to modify response headers, simply place code at the top of each page to do the permanent redirect.

Ex. PHP Redirect
<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.example.com” );
?>

Offline DipakS

  • Full Member
  • ***
  • Posts: 113
  • Karma: +0/-0
    • View Profile
Re: How to resolve 301 Redirect issue?
« Reply #6 on: February 27, 2018, 01:10:25 PM »
Thank you friends, for the suggestions!!! I will implement this on my website. :)
« Last Edit: February 27, 2018, 05:32:42 PM by DipakS »