This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions
 Helicon Tech : Common Questions
Subject Topic: Wordpress Redirect Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Gman
Newbie
Newbie


Joined: 06 September 2010
Location: United States
Online Status: Offline
Posts: 3
Posted: 06 September 2010 at 2:04pm | IP Logged Quote Gman

Hello,

I have a website ( http://www.example.com/health) with Wordpress installed in a sub folder called "health."

Unfortunately, when I access Wordpress, it wants to default to

http://example.com/health  I would prefer to keep the www in the url as it was.

I tried several different rewites, even a Wordpess plugin, yet I can't seem to get it right.

Below is the .htaccess file from Wordpress.  Can someone please tell me how to do the proper url rewrite so that Wordpress open as http://www.example.com/health  ?

Here is the present .htaccess file from Wordpress:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /health/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /health/index.php [L]
</IfModule>

# END WordPress

Thanks very much for your help,

George



__________________
Right On Top, Inc
Back to Top View Gman's Profile Search for other posts by Gman Visit Gman's Homepage
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 07 September 2010 at 4:06am | IP Logged Quote Guests

Hello George,

All you need is additional rule:

Code:
RewriteEngine On
RewriteBase /health/

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


RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /health/index.php [L]


This will redirect all non-www requests to www.

Regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
Gman
Newbie
Newbie


Joined: 06 September 2010
Location: United States
Online Status: Offline
Posts: 3
Posted: 07 September 2010 at 5:05pm | IP Logged Quote Gman

Hi Andrew, thanks for the response and assistance.

Well, we're almost there.   However, the new code in .htaccess (presently removed)  seems to be redirecting me back to the homepage and not the blog page ( and retaining the www in it).

Is it possible that I doing something wrong? Is there anything I can add to the rewrite to get the blog to open at http://www.busbuyer.com/resources ?

As you know, with no .htaccess file in place, typing the url in with www simply redirects back to the non-www version. ( present situation).

Note: I put the .htaccess file ( with the code you provided) in the "resources" folder where Wordpress is installed. 

Thanks again.



__________________
Right On Top, Inc
Back to Top View Gman's Profile Search for other posts by Gman Visit Gman's Homepage
 
lixiang
Newbie
Newbie


Joined: 08 September 2010
Online Status: Offline
Posts: 5
Posted: 08 September 2010 at 4:18am | IP Logged Quote lixiang

I want to know this!
I have faced the same problems!


__________________
MAC Eyeliner Cosmetics
Back to Top View lixiang's Profile Search for other posts by lixiang Visit lixiang's Homepage
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 08 September 2010 at 5:34am | IP Logged Quote Guests

Well, probably it's my bad. I forgot it's not the root, but /health folder:

Code:
RewriteEngine On
RewriteBase /health/

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

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /health/index.php [L]


The idea is that all the requests to example.com will redirect to www.example.com(/health),
then a new request www.example.com/.* go through main wordpress rule.

There's pretty same rule in examples.
Redirecting non-www to www.
Code:
RewriteEngine on

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]


Regards
Andrew
Back to Top View Guests's Profile Search for other posts by Guests
 
Gman
Newbie
Newbie


Joined: 06 September 2010
Location: United States
Online Status: Offline
Posts: 3
Posted: 08 September 2010 at 12:11pm | IP Logged Quote Gman

Hi Andrew,

Thanks again for your time, I will try this out.  BTW, sorry about the confusion in my last email.  I mentioned first a "health" folder, then a "resources" folder in my url.  My bad. I have 3 different Wordpress blogs I am trying to use this redirect on, and  apparently got distracted.

 



__________________
Right On Top, Inc
Back to Top View Gman's Profile Search for other posts by Gman Visit Gman's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum