The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Fri Dec 30, 2005 5:34 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
hi.

I have one .htaccess file like:

##
# @version $Id: htaccess.txt 423 2005-10-09 18:23:50Z stingrey $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

#
#  mod_rewrite in use
#

RewriteEngine On

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update YourJoomlaDirectory (just / for root)

# RewriteBase /YourJoomlaDirectory

#
#  Rules
#

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php



RewriteRule ^news(.*).html$ index.php?option=content&task=section&id=1&Itemid=2
RewriteRule ^links(.*).html$ index.php?option=com_weblinks&Itemid=4
RewriteRule ^contact(.*).html$ index.php?option=com_contact&Itemid=3
RewriteRule ^tourism(.*).html$ index.php?option=content&task=section&id=2&Itemid=25
RewriteRule ^personal_care(.*).html$ index.php?option=content&task=section&id=4&Itemid=26
RewriteRule ^education(.*).html$ index.php?option=content&task=section&id=3&Itemid=27
RewriteRule ^opinion(.*).html$ index.php?option=content&task=section&id=8&Itemid=31
RewriteRule ^hardware(.*).html$ index.php?option=content&task=section&id=5&Itemid=35
RewriteRule ^profesional_services(.*).html$ index.php?option=content&task=section&id=6&Itemid=36
RewriteRule ^shopping(.*).html$ index.php?option=com_content&task=section&id=7&Itemid=93
RewriteRule ^parties(.*).html$ index.php?option=content&task=section&id=9&Itemid=38

RewriteRule ^costaricaproperty(.*).html$ index.php?option=com_content&task=category§ionid=7&id=15&Itemid=37

#RewriteRule ^index(.*).php?option=com_content&task=category§ionid=2&id=7&Itemid=68$ costaricahotel.html

RewriteRule ^costaricahotel(.*).html$ content/blogcategory/7/91/index.php?option=com_content&task=blogcategory&id=7&Itemid=91

#RewriteRule ^costaricahotel(.*).html$ index.php?option=com_content&task=category§ionid=2&id=7&Itemid=68

RewriteRule ^costaricamap(.*).html$ content/blogcategory/51/103/index.php?option=com_content&task=blogcategory&id=51&Itemid=103


But the file don´t work, If I aply that, the server give me problems, and I didn´t see anything bad.

Does you see something wrong?
Thanks

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Last edited by raschidt on Sat Dec 31, 2005 12:57 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Dec 30, 2005 8:53 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Wed Oct 26, 2005 7:57 pm
Posts: 71
Location: Tilburg
Can you post the exact error you get?

_________________
If anything can go wrong, it will.
If there is a wrong way to do something, then someone will do it.
Edward A. Murphy


Top
 Profile  
 
PostPosted: Sat Dec 31, 2005 1:01 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
The problems is:

The link desn´t work!

The link: http://www.SouthernCostaRica.Biz/costaricahotel.html
Must go to:

http://www.SouthernCostaRica.Biz/index. ... &Itemid=91

But it go to home:
http://www.SouthernCostaRica.Biz

The I check the .htaccess file and nothing, all seems to be good!

Note: The .htacces is very long, I only post until costaricahotel.html problem.

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
PostPosted: Sat Dec 31, 2005 2:09 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Aug 18, 2005 5:38 am
Posts: 87
Location: Germany
Possibly you need to move this line

Code:
RewriteRule ^(.*) index.php


down to the last position in the file so that it works as a catch-all only for those requests that your previous entries don't handle.

Kind regards,
Zorro

_________________
http://www.nitsche.org


Top
 Profile  
 
PostPosted: Sat Dec 31, 2005 2:47 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
If I do that the site seems worst, all the images losted, and the templates and the css.

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
PostPosted: Mon Jan 02, 2006 10:42 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 15, 2005 8:51 am
Posts: 10
Location: UK-Wales
Your first rule states that

Everything gets redirected to index.php if
a) the path requested does NOT end with one of .jpg, .jpeg, .gif, .png, .css, .js, .pl, or .txt, AND
b) the path requested does NOT exist as a file, AND
c) the path requested does NOT exist as a directory

This means that if you receive a URL request for, say, www .sitename.com/costaricahotel.html then this first rule will say ...

... there IS a path - costaricahotel.html
... that path does NOT end with one of the stated suffixes
... that path does NOT exist as a file (assuming it doesn't!)
... that path does NOT exist as a directory
... all 3 conditions are true, so redirect to index.php

So, the end result is that unless you create html files to match all your expected URLs (ie. to make condition (b) fail) every URL will be redirected to index.php. All your subsequent rewrite rules become useless.

An excellent help source for .htaccess and mod_rewrite problems is http://www.webmasterworld.com/forum92/

_________________
"Its better to be thought an idiot than to open your mouth and prove it!"


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 12:31 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
Ok, my problem was solved addin html at the end of this:
RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt|html)$

Thanks.

But Now I have one More question:

How can I Redirect from:
http://mysite.com/content/view/277/1/

to

http://mysite.com/component/option,com_ ... temid,117/

I try this two options, but none works:

RewriteRule ^index.php?option=com_content&task=view&id=277&Itemid=1$ component/option,com_hotproperty/task,view/id,18/Itemid,117/

RewriteRule ^content/view/277/1/$ component/option,com_hotproperty/task,view/id,18/Itemid,117/

Thanks.

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 1:50 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 15, 2005 8:51 am
Posts: 10
Location: UK-Wales
1) Where abouts in the .htaccess file are you inserting these new rules?
2) Your first option bears no resemblance whatsoever to the incoming URL, so unless its intended to act on an already-rewritten URL (which wouldn't make much sense!) you can't expect it to work.
3) Your second option looks as though it should match the incoming URL, but unless its the first rule encountered its never going to be hit (for the same reason as my previous post).
4) Why are you trying to redirect an incoming SEF URL to another internal SEF URL, when this automatically means that another rule will have to be actioned for this new SEF URL to be set to the correct internal address? ... unless you want to make it a permanent redirect rather than in internal rewrite, in which case you need to modify the substitution and set the appropriate flags.

Note: Without [L] flags (=last rule actioned) on some of your rules you're making the web server do a lot more than it needs to.

I'm not really sure what it is that you are trying to achieve, but have you tried using one of the SEF components available - like Xaneon Extensions, or 404_SEF? Personally, I have Xaneon Extensions installed and that does everything for me without having to have all those rules in the .htaccess file.

_________________
"Its better to be thought an idiot than to open your mouth and prove it!"


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 7:33 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
1. I don´t know what is SEF.
2. The problem is:
I have a lot of properties (real estate) in my site, but the Joomla sistems don´t fit very good to manage real estate options, then I just install the component hotProperty to manage the properties on the site. But now I have a lot of properties indexed in google and I don´t like loose this positions, then I´m thinking in delette the fist page of properties but redirecting eact location to the new location.

For example, the original location was:
http://mysite.com/content/view/277/1/

But now is:

http://mysite.com/component/option,com_ ... temid,117/


I think the best way for redirect from the old location to the new location is using .htaccess file, but I don´t know how to do it.

Thanks. ;) :)

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 9:08 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Mon Sep 19, 2005 7:34 pm
Posts: 57
Location: Christchurch, New Zealand
I created folders called faq contact and home, then I added one line of code to .htaccess for each folder.  Like this.
Code:
##
# @version $Id: htaccess.txt 1005 2005-11-13 17:33:59Z stingrey $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##

Options +FollowSymLinks

#
#  mod_rewrite in use
#

RewriteEngine On

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update YourJoomlaDirectory (just / for root)

RewriteBase /~dbbooks

#
#  Rules
#

RewriteCond %{REQUEST_FILENAME} !\.(jpg|jpeg|gif|png|css|js|pl|txt)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

RewriteRule ^faq index.php?option=com_simplefaq&Itemid=30
RewriteRule ^contact index.php?option=com_contact&Itemid=31
RewriteRule ^home index.php?option=com_virtuemart&Itemid=26


The URLs the become http://mysite.com/faq
Note, no / is needed at the end if you leave / and $ off the end of faq in .htaccess.  This helps resolve a couple of absolute/relative link problems.  It also depends on your apache as to how these will resolve.  Some will put / on the end anyway.

Preview at http://70.86.30.194/~dbbooks/faq http://70.86.30.194/~dbbooks/contact (real domain not resolved yet)

A couple of issues here.  Different servers have different ways of handling mod_rewrite.  I think it might depends on the version of apache.  I'm running xampp on my windows 2000 box, and it doesn't let me use ReWriteRule to access Joomla rewrites like index.php?action...
Quote:
XAMPP (basic package) version 1.5.0-pl1
  + Apache 2.0.55
  + XAMPP Control Version 2.1 from http://www.nat32.com
  + XAMPP Security 1.0

However my production server does. Linux/Apache, not sure which version.

_________________
http://lucion.co.nz


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 9:50 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
???


??? ???



??? ??? ???

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
PostPosted: Fri Jan 13, 2006 10:22 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Mon Sep 19, 2005 7:34 pm
Posts: 57
Location: Christchurch, New Zealand
je je!!!

Raschidt,

It looks like you've solved your problems, but call me on skype if you need help: b.rudge

Vivo en la argentina, asi que hablo castellano si te es mas facil.

saludos,
Bevan . Leo/

_________________
http://lucion.co.nz


Top
 Profile  
 
PostPosted: Sat Jan 14, 2006 5:27 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Thu Sep 15, 2005 8:51 am
Posts: 10
Location: UK-Wales
raschidt, try

RewriteRule ^content/view/277/1/$ http://mysite.com/component/option,com_ ... temid,117/ [R=301,L,NC]

as the first rule (ie. before your first RewriteCond line).

I understand why you are trying to do this now. It seems that you have a load of links ranked fairly high in the search engine, but you have restructured your site so that those links are no longer valid. When your site gets re-indexed hopefully your new links will also get the same high ranking, but meantime you are trying to ensure that anyone using the old links will still reach the correct (moved) page on your site.
The line above does a permanent redirect, which basically tells the requesting browser that the page has moved and gets it re-request the substituted URL. Given my limited understanding of search engines I am not sure whether its the best solution, but it seems appropriate to me.

BTW: SEF = "Search Engine Friendly", similar to SEO ("Search Engine Optimisation").

_________________
"Its better to be thought an idiot than to open your mouth and prove it!"


Top
 Profile  
 
PostPosted: Sat Jan 14, 2006 11:43 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Mon Aug 22, 2005 7:01 pm
Posts: 233
HEY THANKS, THAT´S THE ANSWE. THAT WORKS. :D ;D ;D

_________________
Manager of http://www.GalleryWebs.com/
http://www.Mercadeo-web.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 



Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group