This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: Wordpress Redirect
Author
Message |
Gman
Newbie


Joined: 06 September 2010
Location: United States
Posts: 3
Posted: 06 September 2010 at 2:04pm

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 Visit Gman's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 07 September 2010 at 4:06am

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
 
Gman
Newbie


Joined: 06 September 2010
Location: United States
Posts: 3
Posted: 07 September 2010 at 5:05pm

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 Visit Gman's Homepage
 
lixiang
Newbie


Joined: 08 September 2010
Posts: 5
Posted: 08 September 2010 at 4:18am

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


__________________
MAC Eyeliner Cosmetics
Back to Top Visit lixiang's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 08 September 2010 at 5:34am

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
 
Gman
Newbie


Joined: 06 September 2010
Location: United States
Posts: 3
Posted: 08 September 2010 at 12:11pm

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 Visit Gman's Homepage
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
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