I want to redirect the index.php from a Wordpress site to another URL, and all the other URLs in the WP site separatley - redirect

So, here is the problem:
I need to have a redirect from website.ro/ to website.com/
Website.ro is on wordpress.
At the same time, all the sub-links like website.ro/title will be redirected individually to website.com/different_title_same_content
If i do this:
Redirect 301 /index.php http://website.com/
Redirect 301 /title http://website.com/different_title_same_content
What happens is that website.ro is on wordpress, that means that all the sublinks are called through index.php (i think, but not sure) and if i do a redirect on index.php than all the other links will be redirected to the homepage and not to their corresponding innerpage.
Its like setting a master rule when i'm redirecting the index.php.
What i would like to do is redirect index.php to a homepage, and any other variation on its corresponding subpage on the new website.
Can it be done?
EDIT: I have added a little of the code that i have to write:
Redirect 301 /Zuzu newsite/portfolio/cases/doc/47860743/
Redirect 301 /Antena1 newsite/portfolio/cases/doc/47860862/
...and so on for allmost 100 urls. (i had to post here without http and www since i am not allowed here more than 2 urls)
The reason i have to do this is that in the past, many of the links on the oldsite appeared in articles, press, blogs and so on, and i do not want to loose traffic that the old links generated on each page.
At the same time, i want to redirect the homepage to the newsite homepage, but if i do this with:
Redirect 301 / newsite/
it will redirect all the other links to the main page of the newsite and not to its corresponding article.
Its the same if i do Redirect 301 /index.php newsite/
since the old website is on wordpress and i think that all the pages are called through index.php(and some variables)
Also, the urls on the newsite.com are not rewritable as to rename them as the old ones so i can create an automated redirect generally valid.
WHAT IS THERE TO DO?

Look into this it may solve your issue
http://enarion.net/web/htaccess/migrate-domains/
Best of luck!

Related

Set my blog as my homepage? Redirect?

When I first started my website, I had a home/landing page and I installed my blog at myurl.com/blog. I no longer need that homepage and am wondering if there is a way to set myurl.com/blog as my homepage? So if someone types in myurl.com, it will automatically go to myurl.com/blog.
I'd like to avoid any "click here to be redirected" or "you'll be redirected in 10 seconds" type of thing.
There are likely multiple approaches, depending on your setup, but IF your setup qualifies (linux hosting etc) then a simple .htaccess permanent redirect would be the simplest approach:
# Permanent URL redirect
Redirect 301 /blog myurl.com

301 redirect only 1 page and not all it's sub pages

Currently I have this redirect
Redirect 301 /partners https://mysomesite/ecosystem
So it redirects correctly by redirecting https://mysomesite/partners to https://mysomesite/ecosystem
But now I have an issue with all the content under /partners/
Now these pages are linking to broken pages. I do not want this to happen.
https://mysomesite/partners/title1/ to https://mysomesite/ecosystem/title1/
https://mysomesite/partners/title2/ to https://mysomesite/ecosystem/title2/
So how to I redirect /partners/ without all its content underneath of it getting redirected also?
Redirect directive appends rest of the old url path to its destination url and it can't be avoided.
If you don't want the trailing path to be appended to your new url and to redirect /partner to a specific location, you can use RedirectMatch .
RedirectMatch 301 /partner/?$ http://example.com/ecosystem
Clear your browser cache before testing this.

Does a Redirect in HTACCESS count as a Google Analytics hit?

I got tried of so many attempts to find WordPress on my web site which does not even have WordPress so I did a Redirect offsite.
Shortly after doing this my Google Analytics bounce rate went up at the exact same time.
Is this just coincidence?
RedirectMatch 302 /wp-login.php(.*) http://www.someotherdomain.com/
Your problem is your htaccess code.
If i follow you properly, you are noticing that people (bots) are visiting pages that do not exist on your site. I can show you the correct notation for your solution, by the way why not redirect to wordpress themselves :) . You also have the choice of redirecting permanently, i would do that instead as it shows visitors the page doesn't exist - you can use '301' (permanent) or '302' (temporary). You can also use "Redirect" for single pages or "RedirectMatch" which uses regex for more multipage re-directs, for your solution either can work, i show both below:
Here are your 2 "Redirect" options:
# Permanent Wordpress bot fix
Redirect 301 /wp-login.php https://wordpress.com/
OR
# Temporary Wordpress bot fix
Redirect 302 /wp-login.php https://wordpress.com/
Here are your 2 "RedirectMatch" options:
# Permanent Wordpress bot fix
RedirectMatch 301 ^/wp-login\.php$ https://wordpress.com/
OR
# Temporary Wordpress bot fix
RedirectMatch 302 ^/wp-login\.php$ https://wordpress.com/
The code that caused your trouble is (.*), this is used in site-wide redirects, usually like this:
# Redirect ALL pages to home page
RedirectMatch 301 ^(.*)$ http://www.sitetwo.com
OR
# Redirect ALL pages, like for like
RedirectMatch 301 ^(.*)$ http://www.sitetwo.com/$1
HTH

How do I do a htaccess wildcard redirect for all pages begining with a numeral

I have a customer who had an indexible IDX attached to his site where the entire MLS for Phoenix was indexed as though each listing were a page on his site. We pulled the plug on this over a year ago but still get 900 404 redirects. Is there some code I can put into his .htacess file that will redirect all of these pages to his home page? Each one of these bogus pages begins with a numeral so if there is a wildcard that I can use that will redirect any page e.g. http://homesaleaz.com/2394emainstreet/ to the home page? I think this indexible IDX was caught by Google and think his site is suffering for this blackhat SEO.
Thanks!
Enable .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
RedirectMatch 301 ^/[0-9]+ /

Sitewide 301 Redirect

I am looking to perform a sitewide 301 redirect. The original site is over 15 years old! I understand the concept of making the .htaccess file with the code:
redirect 301 "/old/old.htm" http://www.you.com/new.html
However will this redirect every page of the old site? or just an individual page. How do I achieve redirection with the entire site?
I have a rewrite in .htaccess (apache rewrite mod enabled), all pages from old site
http://www.old.com and
http://www.old.com/site/index.php? .... redirect to the new site
http://www.new.com or
http://www.new.com/website/index.php?... (notice that /site/ and /website/ are different names)
pages from the old site
https://www.old.com (notice the s on https://) get redirected fine but pages from
https://www.old.com/site/index.php?... do not, they get a 404 error
since the old site is not secure anymore neither the
https://www.old.com or
https://www.old.com/site/index.php?... really exist anymore but
https://www.old.com gets redirected and the ones with
/site/index.php?... added do not get redirected but go instead to a 404 error
Be careful with a 301, 301 redirect is used for where content has moved.
e.g. content about making a cake was here /makeacake.html now is /cakes/making-a-cake.html.
what I would recommend is find the pages where the majority of your uses come to, and redirect those pages to the new relevant pages / sections and just delete the rest and add a custom 404 error page. which tells them the old content has been moved.
You can also use goggle web masters to remove pages from there index.
Assuming the old pages don't exist any more (would throw 404-errors), you can do the following: You redirect all the pages that don't exist anymore to the start page. (As specified in the comments below.)
This is the updated .htaccess code you can use to make that happen. The first RewriteCond checks if the requested path is a file, the second checks if its a directory. After that, you get redirected to the startpage - or any other page for that matter.
http://www.example.com/i/am/an/old/page.html or http://www.example.com/i/am/a/different/old/page.html will all redirect to http://www.example.com/
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [R=301,L]
The best way to redirect the entire site is by doing domain forwarding through your web server (or web host... most have the option in their control panel).
Domain forwarding is much more efficient than sending 301 redirects back to the client.
Am I right in thinking that your site is on the same domain name but you've changed it structurally?
So, you have a load of old page URLs that have now changed to new URLs (but on the same domain).
For example, you may have had:
www.yourdomain.com/about-us/history.htm
that has now become
www.yourdomain.com/our-history.htm
If that is the case you will more than likely need to set up many 301 redirect rules. It doesn't necessarily mean that you have to set up one rule for every single page change as you can use RegEx to catch pattern changes in the URL structure. As a scale example, I recently set up a htaccess file of 301 redirects for a site with just under 600 changed URLs. There were 70-something 301 Redirect rules in the end.
It's not necessarily a small job but it is doable. Worth it to retain your SEO rankings.