Redirect from indexed joomla URLS to static URL - .htaccess

I use to have a joomla site with SEF urls which are indexed in google like
example
www.mysite.com/index.php/contactme
i now have a static site and i want to 301 redirect my indexed urls to the the new one
example
www.mysite.com/contact-me.php
i have tried
Redirect 301 /index.php/contactme http://www.mysite.com/contact-me.php
but i get a internal server error. im complete novice at htaccess. i dont have the old joomla site any more only the static one
hope someone can help
Thanks

I think your redirect is correct in the .htaccess. Maybe the problem is that Google didn't crawl your site again since you changed to the static site. Check in Google webmaster tools to make sure and make a manual crawl using the tools to determine HOW Google sees your site NOW. If it shows correctly then you'll just have to give the engine some time to recrawl and reindex your site.
Hope this helps

Related

301 redirects keep going to page not found

I am currently working on a website. I was not the developer but i am doing the fixes. The plugin simple 301 redirect is being used to redirect the dead site pages to the new live site. The issue is that even tho the url's for the old site is correct and so are the new ones, some of the old url's redirect properly but others are going to page not found. Any advise?

.htaccess redirects - I am completely lost

I am trying to create some redirects using htaccess but I am quite a bit overwhelmed with it all. So here it goes.
The NEW domain is hosted on my hosting account but there is no site built. I just want to use the domain for "easier" branding. Here is what I am trying to achieve.
I want people who go to my NewDomain.com be redirected to an external site: blog.OldDomain.com/podcast/
I also want to create redirects to upcoming new posts. For example, I want to send people to NewDomain.com/1 and have them redirected to blog.OldDomain.com/episode1. Then NewDomain.com/2 would redirect to blog.OldDomain.com/episode2, etc.
I hope someone can help me with this!
Thanks!
Ok nevermind, I found the solution. Simply created
Redirect 301 /index.html http://olddomain. com/podcast/
and I will add new lines as I create new pages ;)

301 redirect all ugly permalinks from old site to new site

So I overhauled a complete website the other day and found some of the old pages snippets in the google search results. The old page had an ugly link structure such as domain.com/index.php?article_id=123. The new site uses pretty permalinks such as domain.com/pagetitle.
Is there a piece of code I could put into the .htaccess file in order to redirect all ugly permalinks to the new site?
Edit
Additional info: The old links don't exist anymore. The old site and the new one's structure differs a lot, not all contents from the all site were adapted. Main problem is that I don't want the old links in the google search results to always throw a 404 at the user.
Maybe something of a
RedirectMatch ^/index.php?$ http://www.example.com/somepage
This will redirect all pages starting from index.php to another location
I don't have the rep to comment on the other answer, but that is a very improper solution if you value your SEO at all. A redirect is your way of telling Google "I've got the same page, I just moved it". There's a much better way to do this that won't negatively affect your SEO at all.
You should create some logic to redirect those old links to your new links.
Here's an example of how you could do it:
Go to the beginning of your program, before any logic takes place.
Use code to retrieve the requested page. In this case, you might be able to get away with simply checking for GET variables that match article_id.
If the requested page is a match for your GET variable, run a query to see if the article exists. (Obviously, you'll still want to 404 articles that don't exist).
Retrieve the content used to generate the new, more SEO-friendly URL's. This is probably the article title or something.
Write some code to generate the new article title. At this point, if this is working properly, you should be able to system print that new URL to make sure it's correct.
301 redirect to the new URL. Don't 302 or any other number, 301 redirect it. This lets search engines know it's the same page and content, but it has permanently moved.

htaccess redirect from development server

The server where I developed a wordpress site was indexed by google. The site is now live with the actual domain, but google searches find links to the site at development server adddress. The site is on the same server where developed, making it live was simply pointing the domain to this new site. I need to redirect these links, but am not having an luck.
Also, the developer server address has a tilda, which was indexed as %7E in google. I have tried various version of the following, all to no avail.
RewriteCond %{HTTP_HOST} ^cardgym\.dcaccess\.net
RewriteRule ^cardgym.dcaccess.net/~chrs/$ http://chrs.org/$1 [R=301,nc]
RewriteRule ^/%7Echrs/(.*)$ http://chrs.org/$1 [R=301,nc]
going to development server results in an 404 error in wordpress: http://cardgym.dcaccess.net/~chrs/
Thanks
Can you change your internal web server configuration so that the development domain is an alias of the live site? That would be the easiest solution imo.
Otherwise check out the answer by Sigg3.net here RewriteRule for tilde
If I understand you correctly your site is live and you moved it to the new domain.
So it appears you already have the live site up and going at http://chrs.org. So there is nothing you need to do to redirect it as far as Google indexing.
It will take Google time to crawl the new site and index it.
You can help speed up the process by asking Google to index your new site by submitting it here.
https://www.google.com/webmasters/tools/submit-url?pli=1
.htaccess does not control the way Google indexes the site. If its on the internet it will be indexed unless you prevent it. There are a few options you can do to help make those dev links disappear.
A. Add a robots.txt to the root of the dev site with this code below in it and that will keep Google/search engines that respect robots.txt from indexing it.
# Make changes for all web spiders
User-agent: *
Disallow: /
B. Block the site using htaccess protected directory for the whole site which will stop it from being crawled.
OR
C. Take the dev site down.
It appears you've already moved the dev site to live domain that's why you are getting 404. The links in Google will disappear eventually because they no longer exist. The next time Google tries to crawl your dev site and see's it's not there the links will be removed. The new site will start to show up as Google begins crawling it. There is nothing you can do right now but wait. It can literally take weeks.
If indeed you really are trying to redirect, then you can add an htaccess file on the cardgym.dcaccess.net site using redirect.
Redirect 301 /~chrs http://chrs.org

.htaccess rewrite base url for Wordpress

Ok sorry if this has been asked before but I could not find a working solution. I am using wordpress multisite. This is what I am trying to achieve.
Currently the domain http://mynew.com/ redirects (via my hosting co.) to one of the sites on my wordpress multisite installation as follows http://myold.com/subsite/
But I want to hide/swap the urls as follows, http://myold.com/subsite becomes http://mynew.com and all links that follow (eg. http://myold.com/subsite/another-link becomes http://mynew.com/another-link) without breaking.
I tried this in my .htaccess file which rewrote the url successfully however the links did not work and returned 404 errors.
RewriteRule ^subsite/(.+) http://mynew.com/$1 [R,L]
Hope that makes sense, thanks for your help.
Of course it will get you a 404 error, you redirected the request from the old site to the new site, but the new site does not contain the requested pages, so it through you a 404, what you need to do is to redirect from the new site back to the old site INTERNALY (that means without changing the browser address bar), but this requires your new site to work as a proxy server, see http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Resources