• Hi, up until a few days ago i had a htaccess file in my root directory, making non www requests forward to http://www.domain i used this code below:

    Options FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^yourdomain\.co\.uk$ [NC]
    RewriteRule (.*) http://www.yourdomain.co.uk/$1 [R=301,L]

    however now when this is in place the blog will not load at all, the blog is in a directory called blog, and in here is also another htaccess file with the following code:

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

    # END WordPress

    because i dont understand htaccess very well im not sure if the 2 are conflicting with each other, any help would be great.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Maybe try this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^yourdomain\.co\.uk$ [NC]
    RewriteRule (.*) http://www.yourdomain.co.uk/$1 [R=301,L]
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    This should be all you need. No need to declare RewriteEngine On twice.

    Thread Starter fatcow321

    (@fatcow321)

    Hi parkstreet, thank you for your time, i added this code below:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^fatcowmedia\.com$ [NC]
    RewriteRule (.*) http://www.fatcowmedia.com/$1 [R=301,L]
    RewriteRule . /blog/index.php [L]
    </IfModule>
    # END WordPress

    and when i try to go to any blog page i get this message:

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    thanks again for your help

    Ok, can you tell me what your error logs says? Also, is your website and blog url http://www.fatcowmedia.com?

    Ohh, sorry, just saw that I missed something, the code should have been:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    Options FollowSymLinks
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{HTTP_HOST} ^yourdomain\.co\.uk$ [NC]
    RewriteRule (.*) http://www.yourdomain.co.uk/$1 [R=301,L]
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    I forgot to include Options FollowSymLinks. Without this, it will cause a 500 internal error. Also, sometimes it written as Options +FollowSymLinks.

    Thread Starter fatcow321

    (@fatcow321)

    hi, thanks again, my server is saying i cannot get access to my error logs, this is crazy, is there any other way of try to work out what the problem is?

    thanks again for your help!

    Thread Starter fatcow321

    (@fatcow321)

    hi, thanks ill try this code

    my website is: http://www.fatcowmedia.com

    and my blog is: http://www.fatcowmedia.com/blog

    Thread Starter fatcow321

    (@fatcow321)

    also should my htaccess be in the root of the domain or the root of the blog directory?

    The wordpress .htaccess should be in the blog directory.

    You should be able to keep the www redirect .htaccess in your root and let that handle all non wordpress stuff as the .htaccess in the blog directory should have priority over that.

    WordPress should redirect to the URL you set it up to i.e. it would auto forward from non www to www.

    Thread Starter fatcow321

    (@fatcow321)

    thank you, this is what i was doing before but if i add the www redirect .htaccess to my domain root it stops the blog working.

    another thing is in the gernal options for

    WordPress address (URL): http://www.fatcowmedia.com/blog

    Blog address (URL): http://fatcowmedia.com/blog

    if i add www to the blog address above it also stops the blog from loading?

    i hope this makes sense, thank you

    Yes, try that code and make sure to check out the website url and blog url in your General settings.

    Thread Starter fatcow321

    (@fatcow321)

    Hi, thank you i just tried that code but i had the same problem, when you say check out the urls in general settings are you saying i need to change something to how they are currently?

    I see you are with Servage. In their control panel under ‘Web Server -> Set .htaccess Files’ is that set to enabled?

    Thread Starter fatcow321

    (@fatcow321)

    Hi, yes thank you it is enabled i just checked that, the thing is i have been using this for months and months with no problem its only since i upgraded to a new dedicated ip address.

    Thread Starter fatcow321

    (@fatcow321)

    do you have any thoughts on that?

    Sorry was out for lunch!

    I think you best bet is to contact your hosting support, make sure everything it set up correctly with regards to rewriting and .htaccess etc.

    Sorry I can’t be of more help.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘fixing Canonical URLs with htaccess’ is closed to new replies.