Force www with SEF doesn´t work in Joomla 3 - .htaccess

When I force redirection from no-www to www (using htaccess) works fine only with the domain.
domain.com (redirect to) → www.domain.com (works fine)
domain.com/category/article/ (redirect to) → www.domain.com/index.php (doesn't work)
First redirects correctly to www.domain.com/category/article/ ( I can view in the browser) and then quickly change to www.domain.com/index.php.
I used a lot of options in htaccess for redirect domain to www. but nothing works.
I disable redirection plugin in Joomla.
If I disable SEF in admin Joomla. Works. With non SEF url works fine.
In the same server in another website with Joomla 2.5 works fine.
Any idea Please?

I believe you have the www redirect in the wrong place in the htaccess file. Here is my boilerplate htaccess I use as a starting point for all Joomla sites on Apache. I've added it to pastebin as the editor here messes with formatting.
http://pastebin.com/yW9r8FQL

Related

htaccess 301 redirect for all versions website

I have a problem with redirecting my website to new domain. I my old domain is https://elysian-store.ir
I decided to buy the .com version in order to have google advertisment for my site (.ir is banned!!! and thought the net was free of politics)
Anyways, here is my situation:
Old website: https://elysian-store.ir
New domain: https://elysian-store.com
I want to redirect all of content old website, to the new with considration of all verieties like :
www.elysian-store.ir or .com
http versions to https versions.
I have added all versions to google web console and tried to implement redirect codes to htaccess of my website.
I use latest version of wordpress.
If someone could put me in the right direction for 301 redirect it would be great.
I have access to website cpanel too.
Do you need the directories to be appended to the redirect? If so then this should work:
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ http://elysian-store.com/$1 [R=301,L]

Redirect any subdomain to same subdomain of different domain

I've moved my site from floriskleijne.nl to floriskleijne.com, and now want any visitor to any subdomain or subdirectory of .nl to be redirected to the .com equivalent of the URL. The challenge is in the subdomains: I have a number of those, and I want them to all be redirected to the equivalent subdomain on the new domain.
So for instance,
en2nl.floriskleijne.nl/ should redirect to en2nl.floriskleijne.com/
www.floriskleijne.nl/about/the-author/ should redirect to http://www.floriskleijne.nl/about/the-author/
floriskleijne.nl/about/the-author/ should also redirect to www.floriskleijne.nl/about/the-author/
I found the solution in this thread, but this does not seem to work for me:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.floriskleijne\.nl$
RewriteRule (.*) http://%1.floriskleijne.com/$1 [R=301,QSA,L]
There are two problems with this approach:
It doesn't work on my site: a subdomain call to the .nl domain gives me an "Apache is working normally" page at the URL I enter, with apparently no redirection at all. And a subdomain call with subdirectories and/or files gives me a 404 error.
Though this htaccess does the job of redirecting to .com, it seems to me that it ignores the no-subdomain version http://floriskleijne.nl. And indeed,iIf at all possible, I would want that to be redirected the same way (identical path). Oddly enough, floriskleijne.nl/whatever.subdir does get redirected properly.
I've checked the DNS, and I have an A record for both floriskleijne.nl and *.floriskleijne.nl, both pointing to the same IP.

htaccess subdomain redirect to non www

For our shop CMS we have a system that works like this:
When a customer registers they will get a subdomain on our root domain.
Something like: myshop.daretoshop.nl
For SEO we want the users to be redirected to the non www version of this subdomain when they enter www.myshop.daretoshop.nl, so they are redirected (301) to myshop.daretoshop.nl
Is this possible with htaccess? We want this so happend with all subdomains, so maybe its possible to set this globally?
thanks in advance.
Use mod_rewrite.
For mod_rewrite directives to work using .htaccess, you need to set AllowOverride FileInfo. Details about how to configure mod_rewrite for your specific needs can be found in one of the similar questions, such as Generic htaccess redirect www to non-www.
You also need to configure your DNS server such that the subdomains are actually resolved to the IP address of your web server.
BTW there are absolutely no SEO benefits in redirecting http://www.example.com to http://example.com.

How to redirect url using sef rewriting and .htaccess on Joomla 2.5?

I've already read everything i could find on this subject but I still can't redirect my new urls to the old ones !
I'm using Joomla 2.5.6, with Apache and the SEF works fine but the SEF-rewrite doesn't. The URL is actually well rewritten but it doesn't redirect me to the old URL.
I already did this manipulation on a Joomla 1.5 site and it worked fine by changing htaccess.txt to .htaccess and by editing configuration.php but it looks like something has changed on Joomla 2.5
Basically I want my new URL: mysite.com/page.html to redirect to the old one: mysite.com/index.php/page.html
I really need you help ! Thanks !
My problem is solved and it was actually something wrong with apache. I had to rename my joomla file (located at /etc/apache2/sites-available) with my domain name. I also uploaded a router.php file (at /components/com_virtuemart) I found on a forum, and now my SEF rewriting works perfectly !

Htaccess redirects my php extensions to example domain

I have no htaccess in my root. But everytime I try to access www.mydomain.com/index.php or any other link that ends with .php it directs me to
http://example.com/folder/index
I can't access by doing mydomain.com everything has to have www.mydomain.com
Fixed itself. Seems it took a little bit to refresh.

Resources