WordPress.org

Forums

www redirect subdirectory (3 posts)

  1. yamenshahin
    Member
    Posted 4 years ago #

    I have wordpress installed in sub-directory
    ex: example.com/wordpress/
    but i wont it to redirect to www
    ex: http://www.example.com/wordpress/

    Thanks
    yamen

  2. Darrell Schauss
    Member
    Posted 4 years ago #

    Maybe try this in htaccess before your wordpress stuff or google "force www htaccess" there are different ways to write these lines.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
    RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]\
  3. crabman27
    Member
    Posted 4 years ago #

    @dralezero -- the 3 lines you suggested worked perfectly for me with one exception. My wp-admin site was no longer accessible, as the redirect prevented me from getting to example.com/wp-admin/.

    Is there a way to exclude the wp-admin site from the redirect? Or can I access the admin site from http://www.example.com/wp-admin somehow?

    Thanks,
    Jon

Topic Closed

This topic has been closed to new replies.

About this Topic