SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't get the Rewriting to work

    I actually never used URL Rewriting! At the moment I am playing a bit a round with it but I cant get it to work. I have actually 2 questions:

    1. In what folder do i place the .htaccess file? Should that be the httpdocs folder?
    2. How would I Rewrite this url:
      http://www.hotelamaryllis.gr/index.cfm?language=gre
      to
      http://www.hotelamaryllis.gr/index/language/gre
      in such a way that this rule will work for every page


    Thank you all in advance!
    Last edited by Mittineague; Mar 20, 2014 at 14:37. Reason: delinking example URLs
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  2. #2
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, so I found this article which descibes actually what I am looking for. They suggested to write the following rule:
    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^index/([A-Za-z0-9-]+)/?$ index.cfm?language=$1 [NC,L]
    I added the .htaccess file to the same directory (httpdocs) as index.cfm which should give me the desired result but I still get the url old style e.a.
    http://www.hotelamaryllis.gr/index.cfm?language=gre

    What am i doing wrong?
    Last edited by Mittineague; Mar 20, 2014 at 14:38. Reason: delinking example URL
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  3. #3
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,281
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Two things. First, based on the links in your first post, you probably want your rewrite rule to be this:

    RewriteRule ^index/language/([A-Za-z0-9-]+)/?$ index.cfm?language=$1 [NC,L]

    And second, I want to make sure your expectations are set appropriately. Even after this rewrite rule, the ugly-looking URL will still exist and still work. The rewrite rule allows the pretty-looking URL to work in addition to the ugly-looking URL. If you have HTML links, you'll need to update them to point to the new pretty-looking URL.
    "First make it work. Then make it better."

  4. #4
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jeff.

    This entire .htaccess thing is confusing me a lot!
    Even after this rewrite rule, the ugly-looking URL will still exist and still work. The rewrite rule allows the pretty-looking URL to work in addition to the ugly-looking URL. If you have HTML links, you'll need to update them to point to the new pretty-looking URL
    How would I accomplish this?

    This is an example from a link in my html:
    HTML Code:
    <li><a href="index.cfm?language=eng" hreflang="en" title="">EN</a></li>
    Thank you in advance!!
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This might be a funny question to ask but here goes. I see you are using Coldfusion. Typically I've seen Coldfusion run under Windows Server which usually means it uses IIS.

    Do you know what server software you are running your website under? Are you using Apache or IIS?
    MYCFMX (Under Construction)
    http://www.mycfmx.com/

    More from me - coming soon

  6. #6
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RobbieGoD View Post

    Do you know what server software you are running your website under? Are you using Apache or IIS?
    Hi Robbie. Locally I am running IIS but on the server Apache.
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    htaccess won't work under IIS unless you have some plugin or something installed on the server but right out of the box IIS doesn't use htaccess. htaccess works with Linux / Apache.

    Your htaccess should work on the server since you are using apache, but it won't work locally because you are running IIS.

    See this thread here for more details - you can add something to your IIS to make it support htaccess, but out of the box IIS doesnt know what htaccess is:

    http://forums.iis.net/t/1146147.aspx?+HTACCESS+to+IIS+7
    MYCFMX (Under Construction)
    http://www.mycfmx.com/

    More from me - coming soon


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
  •