Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    simple .htaccess redirect?

    Hi,

    This is the code wordpress added into my .htaccess file can anyone explain it to me im trying to understand it better?


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


    I was also wondering how I could modify it so that www.example.com would redirect to www.example.com/example ?

    Thanks Jonny

  • #2
    New Coder
    Join Date
    Feb 2013
    Location
    Liverpool
    Posts
    70
    Thanks
    1
    Thanked 4 Times in 4 Posts
    This is just enabling the apache rewrite module so that you can use URL rewrites for more seo friendly urls - instead of /rubbish-dirty-urls.php you'd get /nice-clean-urls

    To do a simple 301 redirect use the following code:

    PHP Code:
    Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html 

  • Users who have thanked edgethreesixty for this post:

    n00bctrl (03-27-2013)

  • #3
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    So then would it look like this?? Or does it have to be in the if statement? Also for a URL do you need the .html at the end?

    Redirect 301 /index.html http://www.dogwalkuk.co.uk/register.html

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

    # END WordPress

  • #4
    New Coder
    Join Date
    Feb 2013
    Location
    Liverpool
    Posts
    70
    Thanks
    1
    Thanked 4 Times in 4 Posts
    I'd do it within the conditional fields and it doesn't matter about the .html that was just an example - you can have any URL you want.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •