mod_rewrite for sef enabled joomla site - mod-rewrite

my site is sef enabled and done in joomla.
what i need is a rewrite rule so
http://www.testsite.com/fr/corporate/news points to http://www.testsite.com/corporate/news/?lang=fr
i tried few url rewrite rules but it generates 404 error category not found page. i believe it looks for thr fr folder or a category called fr.

I assume you need it to work regardless of what is after /fr? You could try something like this:
RewriteRule ^/fr/(.*) /$1\?lang=fr [R=301,L]

Related

Joomla 2.5: How to remove the parent category from URLs?

I'm trying to migrate my Web site from Joomla 1.5 to Joomla 2.5. After running RedMigrator I've got all articles imported in my new Web site. The URL of Joomla 2.5 articles is however different from the original one. In particular I'd like to get rid from the URL of the parent category so that it looks like
host/category/article
instead of:
host/parent-category/category/article
Is there any way to do it from the configuration or do I have to use mod_rewrite to get my URL rewrited by Apache ?
Thanks!
In my experience there's no way to do this without third-party extensions, though you might experiement with creating a hidden menu containing an item for the sub-category's blog layout.
Simply remove a url segment with .htaccess
In your .htaccess file:
RewriteEngine on
RewriteBase /
RewriteRule ^/parent-category/(.+)$ /$1 [L,QSA]

How to eliminate a sub-directory level from all URLs in Website

I have a website and I just setup an os shopping cart (ie., Magento)
I installed the cart in a sub-directory off the document root as /magento/ per the installation guidelines.
So my web site cart's URL is http://mydomain.com/magento/
I have no public pages off the document root and I actually want my cart to be my home page -- in other words, I want http://mydomain.com/magento/ to resolve as http://mydomain.com/
Is it possible? Can I use mod-rewrite to make it happen? If so, can you suggest what the mod-rewrite directives would look like?
Or is it simply a permanent redirect like:
redirect 301 /magento http://mydomain.com/
Thanks.
You can use:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/magento
RewriteRule ^(.*)$ /magento/$1
In this way, it should replace everything with /magento in front of it. So, you can have your links to point on your root.
I've edited and tested it, it works.
Now that I've better read your question, it seems you want to redirect only the home page, and not the whole site:
RewriteEngine on
RewriteRule ^$ /magento/

present a static page url as different url which is SEO friendly

I have developed a site, which has some static pages. Like explore, home, feedback.
The link for these goes as follows
website.com/views/explore.php
website.com/index.php
website.com/views/feedback.php
I want to write a different SEO URL for each of the URL mentioned above.
Is it possible ?
i.e. for example
website.com/views/explore.php should be convereted/visible as website.com/explore
website.com/views/feedback.php should be convereted/visible as website.com/give/feedback
and so on
You can use these mod_rewrite rules to rewrite requests to /explore and /give/feedback internally to /views/explore.php and /views/feedback.php:
RewriteEngine on
RewriteRule ^explore$ views/explore.php [L]
RewriteRule ^give/feedback$ views/feedback.php [L]
with .htaccess file you can change any url on your site. i love this file.
if you are hosting website in ISS the you can try IIS SEO toolkit. & set dynamic URL itself in IIS
see the indepth explaination by Scott about Imporve SEO by SEO Toolkit

Redirecting all dynamic URLs from an old site to a single static url

We had an old coldfusion website a couple of years ago and I recently realized there are some old links still floating around causing 404 errors. I don't know what was on any of the pages and I just want to redirect them to a new static page. Our new site is a Joomla 1.5 site with SEF URLs turned on.
An old URL would look like this: http://www.example.com/content.cfm?id=2010 where the only difference between the URLs would be the number after id=.
I want to redirect any URL that begins with content.cfm to a the static page http://www.example.com/oops-thats-an-old-page which lists some helpful links to find what they are looking for.
I am successfully accomplishing this with the following code in the .htaccess file:
RewriteCond %{QUERY_STRING} id=
RewriteRule (.*) http://www.example.com/$1? [R=301]
RewriteRule ^content\.cfm$ /oops-thats-an-old-page [R=301,L]
I'm new to rewriting URLs and I'm not sure this is the best way to do it. I am also concerned that it may brake non-sef joomla URLs that I am not aware of because they also have the id= in them.
Can I make the rewrite conditional on whether or not it begins with content.cfm?
The first rule will already be applied when the query contains id=. If you don’t want that but rather redirect only if /content.cfm with query containing id= was requested, try this rule:
RewriteCond %{QUERY_STRING} id=
RewriteRule ^content\.cfm$ /oops-thats-an-old-page? [R=301,L]

joomla - SEO settings and mod_rewrite

I'm using Joomla 1.5.14 and I configured SEO as in the following image
Now I need to map a few old URL to the new site
let's say that I need to map htp://mysite/old.html to the new Joomla page
http://mysite/index.php?option=com_content&view=article&id=32&Itemid=70
I added in my .htaccess file the following
RewriteRule ^old\.html$ index.php?option=com_content&view=article&id=32&Itemid=70 #works!!
this works fine, but if I use the SEF URL in .htaccess (let's say the above page can be reached with htp://mysite/contacts.html), I obtain a 404 error
RewriteRule ^old\.html$ contacts.html #this does not work
Now the question:
Is it possible use SEF URLs in RewriteRule? where am I wrong?
thank you in advance
stefano
I think the problem is because Apache rewrites old.html to a page that doesn't actually exist, but rewritten in a different rule.
If you truly want to "rewrite" - in other words, have the page stay as old.html in the browser - then you don't need to do anything.
However to avoid duplicate content it's probably better to do a 301 redirect:
Redirect 301 old.html http://yoursite.com/contact.html
(You may need a forward slash at the front of old.html)

Resources