SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    vi
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question SEO Help please, with link going to correct SEO path

    I need som SEO help here, I am using joomla with custom coded added.

    But when we trun on our SEO feature everything is good, but our links are not going to the correct path.

    Code:
    Here is an example of NON-SEO link
    http://site.com/index.php?option=com_community&view=profile&userid=userid&Itemid=100
    
    
    When we turn on SEO
    
    The link is
    http://site.com/community/65-sexyapp/photos
    
    
    But we need it to REad
    http://site.com/components/community/userid-username/photos
    We've tried

    Redirect /community/$1/photos /component/community/$1/photos
    DOES NOT WORK


    WE've also Tried
    RewriteRule ^component/([a-zA-Z0-9_-]+)/$1-$2/([0-9]+)\ http://site.com/index.php?option=com_community&view=profile&userid=$1&Itemid=$ [NC]

    Still nothing works, it just remains to the default, SEO change that is not correct, please HELP

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)
    Dan,

    What you REALLY need is help with mod_rewrite. However, what you're attempting needs to be "mapped" and you've not made it easy (changing Itemid numbers et al). If you have a look at the tutorial linked in my signature, you'll understand why.

    Comments on your code:

    Target = http://site.com/index.php?option=com...rid&Itemid=100

    URL = http://site.com/community/65-sexyapp/photos

    How do you get com_community from community, where does profile come from, is 65 the userid and where does sexyapp/photos get redirected to?

    Quote Originally Posted by Dan
    No, actually, you need it to read com_community (components/community), you should hide userid- rather than identify the key for username and, again, where does photos tell Apache how to get Itemid=100?

    Quote Originally Posted by Dan
    Code:
    RewriteRule ^component/([a-zA-Z0-9_-]+)/$1-$2/([0-9]+)\ http://site.com/index.php?option=com_community&view=profile&userid=$1&Itemid=$ [NC]
    ARGH!

    You cannot put $1 or $2 in the regex of a RewriteRule and your \ is escaping a space which is not allowed (outside a character range definition. You DID get the position of the hyphen correct in your first character range definition, though, so you're ahead of many mod_rewrite newbies.

    The redirection doesn't need to be external (http://site.com/) but the Itemid's value is missing. Further, the No Case flag is inappropriate for a RewriteRule (because the {REQUEST_URI} string is case sensitive ... and you've used [a-zA-Z] which is the correct way to deal with that).

    WARNING: CMS's create their own mod_rewrite and use modules to reformat your links so the modules can read them and fetch the correct record(s) from your database. Messing around with mod_rewrite will change this and likely collapse your CMS website ... if you're not both knowledgeable and very careful.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •