Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other htaccess redirect

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35759
    matt44903
    Member

    Ok, I have two different url’s, I will call them example-page.com and examplepage.com
    The two domains are getting served the same servers so it is the exact same content, with different URL’s.

    I want to get the one with the dash (example-page.com) to automatically redirect to the one without the dash (examplepage.com). Can I use htaccess only to do this? Or should I use another method? Just so you know, I have googled this, but maybe I am not asking the correct questions? It can not be a normal redirect because it will redirect both of the url’s right?

    The reason I am doing this is because I am using Facebook comments and the URL gets passed in, and so there would be two different comment sections for the same page.

    #93157
    SgtLegend
    Member

    This is what you would need to use

    RewriteCond %{HTTP_HOST} ^www.old-domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]
    #93174
    matt44903
    Member

    Thank you so much. I have no experience with this, and had no clue what to look for. Searching “redirects” only gave me the typical entire site 301.

    Thanks again.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Other’ is closed to new topics and replies.