ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Index.php SE Friendly redirects

November 06, 2007 3:02pm

Subscribe [2]
  • #1 / Nov 06, 2007 3:02pm

    lemonman

    68 posts

    Hi All,
    I would like to redirect all of the underscored URLS that google has indexed to versions with dashes - using a ‘301 permanently moved’.

    I am preparing to go into Global weblog preferences and change the Word Separator for URL Titles drop down to ‘Dash’.

    Before I do this I want to make sure that when google comes back to old urls with underscores they are taken to the ‘dashed’ version of the URL and is read as a 301 redirect.(so google knows it has moved permanently).

    I have many template groups which are being used to display content.


    I run into problems when I have a url that read such as the following:

    <a href="http://www.mysite.com/blog/SPORTS/sports_comments/my_article_with_underscores">http://www.mysite.com/blog/SPORTS/sports_comments/my_article_with_underscores</a>


    I have attempted to redirect the article above to:

    <a href="http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores">http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores</a>

    When I do this - the rewrite rule which handles all requests to the ‘blog/’ folder and hides the use of index.php ends up rewriting my url as

    <a href="http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores/?/SPORTS/sports_comments/my_article_with_underscores">http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores/?/SPORTS/sports_comments/my_article_with_underscores</a>.


    I am currently using the rewrite rule provided in the Wiki Docs which removes the index.php from the url. It reads as follows:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^blog/(.*)$ blog/index.php?/$1 [L]

    So as if i haven’t complicated things enough, how can i perform a hard coded redirect which will handle each page as needed(dynamic would be preferred but i am willing to settle).

    The rewrite rule i am using which produces my results is:

    Redirect 301 /blog/SPORTS/sports_comments/my-article-with-underscores <a href="http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores">http://www.mysite.com/blog/SPORTS/sports_comments/my-article-with-underscores</a>

    Can anyone help with this?
    Any help is appreciated.
    Thanks,
    L

  • #2 / Nov 07, 2007 9:49am

    lemonman

    68 posts

    Have i posted a topic that is too complicated?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases