Joomla rewrite rule always 404s - .htaccess

I have the below rewrite rules in my .htaccess file on my Joomla installation.
RewriteRule ^hire/([0-9a-zA-Z-&]+)/([0-9a-zA-Z-&]+) /section?section=$1&sub_section=$2 [NC,L,R]
This works great, but I'd like to remove the R part so that it doesn't redirect, and the URL stays the nicer looking SEO friendly version. The trouble is that when I do this, I always get a 404 page.

Related

Wildcard RewriteRule for 301 redirects in htaccess

I'm working on setting up a 301 redirect in an .htaccess file and I can get it to sorta work, but I'm not sure why it's not picking up on anything after a specific URL in the rewrite rule.
I currently have this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/old-path/page/(.*) /new-page/ [R=301,L]
</IfModule>
Which works fine if I test it with http://example.com/old-path/page which redirects to http://example.com/new-page
But if I try this:
http://example.com/old-path/page/test it will 404 and not redirect to http://example.com/new-page
Overall, since I'm not 100% if there are any other pages from the old path that may be nested within the page I want to make sure that I'm catching any of them and just redirecting to the new-path outright.
So, I'm not sure if I'm setting this up incorrectly or if there is something that I'm missing?

Redirect permanent tag in Joomla

Due to a recent data update to Joomla 3.3.6 there are several URLs that give 404 as the Taxomy component used in Joomla 1.5.26 is not supported in Joomla 3.x
I want to do a permanent redirect those old URLs to new, I used this rule in the htaccess but does not work:
RewriteRule ^http://www.vistaalmar.es/tag/(.*)$ http://www.vistaalmar.es/component/taxonomy/$1 [L,R=301]
I could give any other ideas for this redirection.
If your links already have /component/taxonomy/ part and you want to redirect them to /tag/ you have to change your rule as:
RewriteRule ^component/taxonomy/(.*)$ /tag/$1 [L,R=301]
Hope this helps

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]

URL rewrite works with 301 or absolute path but not without

I'm trying to show the user the content of http://www.mysite.com/booking-request?code=### when visiting a url such as http://www.mysite.com/booking/ZHTU78
I'm sure this is simple, but I cannot understand why the following rule is not working for me. All I get is a 404 error.
RewriteRule ^booking\/([\w\d]+)$ /booking-request?code=$1 [L]
If I change the rule to
RewriteRule ^booking\/([\w\d]+)$ /booking-request?code=$1 [L,R=301]
It works, but with the obvious undesirable side effect of actually redirecting the browser to http://www.mysite.com/booking-request?code=###
I've also tried changing the url to redirect to to a single / to make sure it should be looking for an existing page, but no change.
It might be pertinent to mention this is on a drupal site and /booking-request is essentially a basic page, so drupal will have some functionality to redirect this page anyway, however I wouldn't have thought it should matter in this case.
edit
Here's a link to the whole htaccess file: http://pastebin.com/KPE6DK6N
Try change the rule to:
RewriteRule ^booking/([\w\d]+)$ /booking-request?code=$1 [L]
or
RewriteRule ^booking/([\w\d]+)$ http://www.mysite.com/booking-request?code=$1 [L]
It should work.

301 Redirect on older Joomla SEF URLS

I am working on removing an old Joomla 1.0 site that has the SEF module installed. I need to redirect the URLs to static pages in a search engine friendly way.
A typical URL looks like: www.mysite.com/index.php?/this-page.html.
I need to forward it to a static page on the same site like: www.mysite.com/this-page.html
So, I edited htaccess to read:
redirect 301 /index.php?/this-page.html http://www.mysite.com/this-page.html
The redirect does not seem to work. Any ideas? A wild card redirect to strip out the "/index.php?/" would be a bonus since I have to do about 80. I'm happy to do them manually, too.
try this below and let me know
redirect /index.php?/this-page.html http://www.mysite.com/this-page.html
Add in your .htaccess
Redirect /path/to/new/folder http://www.yoursite.com/new_page.html
The firs argument should be the path to the folder
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php/
RewriteRule ^index.php/(.*) /$1 [R,L]
This eliminates index.php from all old sef urls

Resources