Submit Your Article Forum Rules

Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: 301 reditects, .htaccess and Wordpress

  1. #1
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    301 reditects, .htaccess and Wordpress

    Hey ladies and men who are gentle...

    So for a search for one of my services I found a link in the SERPs that goes to a 404 page and I was trying to re-use my other .htaccess 301 redirect code on this site but it wouldn't work.

    The url in question is similar to the following:

    Code:
    http://www.mydomain.com/2009/09/seo-web-design-services/

    The .htaccess code is the following:

    Code:
    RewriteRule ^2009/09/seo-web-design-services http://www.mydomain.com [R=permanent,L]
    But this is a definite no go and I'm not a master with .htaccess and redirects.

    Any help is totally appreciated as I would LOVE to get that 404 page out of my user's view.

    wige??
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  2. #2
    Senior Member Uncle Dog's Avatar
    Join Date
    Apr 2008
    Posts
    342

    Re: 301 reditects, .htaccess and Wordpress

    Your .htaccess should start with these lines.

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    +FollowSymlinks is probably already enabled, but it doesn't hurt to try again.
    RewriteEngine may be on, but...

    Your RewriteRule
    Code:
    ^2009/09/seo-web-design-services
    means urls starting with 2009/09/seo so...

    it's simplest to just put the full url first
    Code:
    RewriteRule http://www.mydomain.com/2009/09/seo-web-design-services http://www.mydomain.com [R=permanent,L]
    I like .htaccess tips and tricks for gentle reminders.

  3. #3
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Re: 301 reditects, .htaccess and Wordpress

    Thank you for the link UD.

    This didn't work

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule http://www.mydomain.com/2009/09/seo-web-design-services http://www.mydomain.com [R=permanent,L]
    Did I do something wrong?
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  4. #4
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Re: 301 reditects, .htaccess and Wordpress

    I also have this in my current .htaccess file:

    Code:
    # BEGIN wordpress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END wordpress
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  5. #5
    Senior Member Uncle Dog's Avatar
    Join Date
    Apr 2008
    Posts
    342

    Re: 301 reditects, .htaccess and Wordpress

    The [L] means Last Rule so... if the conditions for a rewrite were met then it will be actioned but anything following it will be ignored.

  6. #6
    Senior Member Uncle Dog's Avatar
    Join Date
    Apr 2008
    Posts
    342

    Re: 301 reditects, .htaccess and Wordpress

    The wordpress conditional says

    If you can do rewrites?

    Switch the rewrite on
    The directory root (for this) is /
    Here's a trap for a missing file request
    Here's a trap for a missing directory request
    If a trap has fired... go to this page [Don't do any more]

  7. #7
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Re: 301 reditects, .htaccess and Wordpress

    OK I edit it to this:


    Code:
    # BEGIN wordpress
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule http://www.mydomain.com/2009/09/seo-web-design-services http://www.mydomain.com [R=permanent,L]
    RewriteRule . /index.php [L]
    </IfModule>
    # END wordpress
    that didn't work...and actually caused and Internal Server Error...

    but thank you for trying to help UD...
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  8. #8
    Senior Member Uncle Dog's Avatar
    Join Date
    Apr 2008
    Posts
    342

    Re: 301 reditects, .htaccess and Wordpress

    No!

    Code:
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    
    RewriteRule http://www.mydomain.com/2009/09/seo-web-design-services http://www.mydomain.com [R=permanent,L]
    
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule . /index.php [L]
    </IfModule>
    Having said all that. If you just changed the existing Wordpress Rewrite to [R=permanent,L] then anything missing would be permanently redirected.

    One of the problems of only seeing part of the problem, you only get part of the solution.

  9. #9
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Re: 301 reditects, .htaccess and Wordpress

    OK honestly UD, I really don't mean to bug ya but that didn't work...

    the exact code I have written in there right now is what you have above (with my domain) and it's not throwing a server error but not at all redirecting...
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

  10. #10
    WebProWorld MVP morestar's Avatar
    Join Date
    Jun 2007
    Location
    Toronto, Ontario (Burlington)
    Posts
    4,249

    Re: 301 reditects, .htaccess and Wordpress

    lol you're signature UD...that cracked me up...
    Join a free dating site and meet single people in your area.
    Submit your content at my content publishing site and promote your business, services or opinions.

Page 1 of 3 123 LastLast

Similar Threads

  1. Wordpress SEO & Security Friendly .htaccess & Pugins
    By Webnauts in forum Internet Security Discussion Forum
    Replies: 23
    Last Post: 03-29-2012, 08:50 AM
  2. Need help on wordpress .htaccess
    By loosapphire in forum Search Engine Optimization Forum
    Replies: 11
    Last Post: 10-09-2009, 04:00 AM
  3. WordPress htaccess issues
    By imsickofwebpro in forum Web Programming Discussion Forum
    Replies: 6
    Last Post: 01-18-2008, 09:59 PM
  4. Combining my .htaccess rewrites with WordPress rewrites
    By mantawebsolutions in forum Web Programming Discussion Forum
    Replies: 5
    Last Post: 04-05-2007, 02:46 AM

Posting Permissions

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