Redirect home page htaccess, keep the rest - .htaccess

I have a Joomla site with a blog attached to it.
I created a new homepage for it, though, that uses just plain html and have uploaded it to the /new/ directory. I'm trying to write an htaccess redirect that will allow me to use the /new/ directory just for the homepage, but still use the Joomla part for the blog.
Here's what I have tried so far, but it doesn't work.
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule ^ /new/ [L]
This actually redirects it in the browser to /new/ instead of doing it underneath the hood, invisibly. Also when I go to the /blog/ page, it is very messed up. In sum:
domain.com --> domain.com/new/ (but don't show the redirect)
domain.com/* --> allow joomla to do its thing

I couldn't get #anubhava solution to work, so I just moved my whole joomla installation into the /blog/ folder. There are just a couple of changes that you have to make in the configuration.php file. After that I put my new site in the root folder.

Related

Opencart dont redirect not found links

I migrated my e-commerce site oscommerce to open-cart and my old links coming to the open-cart site. whenever old links requested open-cart redirects to the homepage if the pattern is like this .../index.php?manufacturers_id=...
I changed .htacess file to exclude redirect to the homepage by defining these lines
RewriteCond %{REQUEST_URI} manufacturers_id
RewriteRule .* NOT.php
if requested url contains manufacturers_id "it will" redirect to NOT.php instead homepage. But these .htaccess definitions don't work
I also want to cancel 404 pages I prefer to use the server default error page.
How can I make this? Thank you

.htaccess redirect from mysite.com/ to mysite.com/index.php/folder

I have a mirrored site and I need all the visitors to be redirected to a certain page other than the original homepage. But the original site (not the mirror) should continue to behave without changes. Therefore, I need to include a redirect rule in my .htaccess based on the referrer. If the visitor targets the mirrored site, I need to redirect. If the visitor lands at the original site, nothing should be done.
How do I implement this?
If you have the following setup:
fancysite.com - your main site with all the pages
coolname.com - a site that should redirect all requests to your main site
For example, a user requesting www.coolname.com/infos/january.html should be redirected to www.fancysite.com/infos/january.html.
This redirect should be done with a 301 HTTP response (moved permanently) for several reasons, e.g. google preferring it.
To do this on an Apache server, you put a .htaccess file in the root directory of your website (may differ from the root of your account). The server must have the module mod_rewrite and you must have the rights to use it.
Put the following in your .htaccess to redirect all requests, as you do not want to update it for every new page you put on your site:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !fancysite.com$ [NC]
RewriteRule ^(.*)$ http://www.fancysite.com/$1 [L,R=301]
The module mod_rewrite is very powerful, have a look at the documentation, if you have the time:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Redirection to subdirectory with no pathname of subdir

I have a shared host. Default url, www.mywebsite.com, on that host points to public_html directory. I have build a new directory, wordpress, under public_html. And i want to redirect my users to the wordpress directory. But i don't want to show /wordpress/ pathname on address bar.
What i have tried until now with .htacces puts the /wordpress/ pathname on address bar like www.mywebsite.com/wordpress/. However i want to show www.mywebsite.com even if it was redirected to the wordpress subdirectory.
In general you just point it using .htaccess but I think there are other considerations as well. There is already an article from wordpress on how to do this as this is a very common thing. That is the best place to start is on wordpress' site.
In the htaccess of the root, you should be able to do a simple rule like this.
RewriteEngine On
RewriteRule ^/?$ /wordpress [L]
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

301 redirect for domain change

My friend would like to change her domain oldsite.com to newsite.com.
The hosting company is lukrativedomains and they suggested changing the domain to newsite.com and then forwarding oldsite.com to newsite.com
However, the forwarding feature they offer will redirect all pages to the root newsite.com. I want to be able to forward all the individual pages of oldsite.com to the same page on newsite.com
Do I need to copy the content from oldsite.com to newsite.com and then implement a 301 redirect? If so, how do I do that and would that be duplicate content?
Also, how would I go about doing the 301 redirects for each page? What do I need from her? (htaccess? if so where would that be?)
As of right now, newsite.com does not have anything on it, it is just a parked page but I want it to look exactly like oldsite.com.
It is very important to do this while minimizing effects on SEO. She does not use wordpress, in fact, I am not really sure where the content lives (I am guessing on ftp somewhere)
here are my steps that i would do in this case
Create a full site backup (files and databases)
Upload them to the new site and check that everything works fine.
In the root folder (usually if you are using Cpanel that would be the public_html folder) i would create and .htaccess file with the 301 redirections
Code example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^oldpage.html$ http://www.newsite.com/newpage.html [R=301,L]
</IfModule>
Take a good look at the 3ed line whats going on,
I say RewriteRule and then "^" and the name of the page, that looks like in full url like this: http://www.oldsite.com/oldpage.html
So for example lets say that you want to redirect this url:
http://www.oldsite.com/categories/business/news.html
You would put it like this:
RewriteRule ^categories/business/news.html$ http://www.newsite.com/categories/business/news.html [R=301,L]
If it does not end with .html .php it would look like this:
RewriteRule ^categories/business/news/$ http://www.newsite.com/categories/business/news/ [R=301,L]
Also if you would like to learn a bit more about redirections i would suggest reading this article: http://moz.com/learn/seo/redirection

301 redirect old link to new sub directory

I am trying to do a redirect in my Joomla .htaccess file
The incorrect link is:
http://nilandsplace.com/index.php/camping_eng/camping?___store=camping_eng
I am trying to get it to go to:
http://nilandsplace.com/store/index.php/camping/camping-home/?___store=camping
No mater what 301 redirect I have tried it does not work I get a 404 page not found or I get a 500 server error. It also could just go to:
http://nilandsplace.com/store/camping/
I almost got it to work by getting rid of the index.php in the link, but there are a lot of old external links in that have it with the index.php. I have tried more then 15 different ways and still can't get it without destroying my Joomla link
http://nilandsplace.com/index.php
I know the basics, the rewrite engine is on and I have been putting everything before the Joomla redirects that are many. The Joomla .htaccess is the basic one that comes with Joomla install.
Thanks James Niland
http://nilandsplace.com
You can use this rule as your very first rule in your root .htaccess:
RewriteCond %{THE_REQUEST} /camping_eng/camping\?___store=camping_eng [NC]
RewriteRule ^ /store/camping/? [R=301,L]

Resources