• Drewbarb
  • Born
  • Born
  • Drewbarb
  • Posts: 2

Post 3+ Months Ago


I've been encountering a problem with a part of my site that requires the header location to be http://***.com. It's a log in page, which works with this code:

Code: [ Select ]
      $_SESSION['shid'] = $user->id;
      $_SESSION['shpass'] = $password;
      $_SESSION['shpin'] = $pin;
      header("Location: http://***.com/*/");
  1. }else{
  2.       $_SESSION['shid'] = $user->id;
  3.       $_SESSION['shpass'] = $password;
  4.       $_SESSION['shpin'] = $pin;
  5.       header("Location: http://***.com/*/");
  6.       die();
  7.     }

Whenever someone types in http://www.***.com, it redirects to http://www.***.com.

This doesn't work and when the person tries to log in the header updates to http://, which means that the person has to log in again. To make it more efficient, I want www to redirect to http://***.com automatically.

I have this .htaccess code; however, it doesn't do what I want it to do:

Code: [ Select ]
Options +FollowSymLinks -MultiViews
RewriteEngine On

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

RewriteCond $1 !^(board|staff-hut|content|images|library|mail|phpmyadmin|support|shoutout|ajax\.php|global\.php|index\.php|favicon\.ico|info\.php|index2\.php|system|application|load\.php|engine\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^(.*)$ /index2.php/$1 [L]
  1. Options +FollowSymLinks -MultiViews
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^www\.***\.com$ [NC]
  4. RewriteRule ^(.*)$ http://***.com/$1 [R=301,L]
  5. RewriteCond $1 !^(board|staff-hut|content|images|library|mail|phpmyadmin|support|shoutout|ajax\.php|global\.php|index\.php|favicon\.ico|info\.php|index2\.php|system|application|load\.php|engine\.php)
  6. RewriteRule ^(.*)$ /index.php/$1 [L]
  7. RewriteRule ^(.*)$ /index2.php/$1 [L]

/staff-hut is the location of the page.

Any suggestions on how I can edit .htaccess so that www redirects to http://***.com?

  • dark_lord
  • Graduate
  • Graduate
  • User avatar
  • Posts: 162
  • Loc: India-Kolkata

Post 3+ Months Ago

why don't you use the cpanel redirect option?

make 301 permanent redirection?

check the box (Only redirect with www) while doing that

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 37 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.