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!

Ok, so I found this article which descibes actually what I am looking for. They suggested to write the following rule:


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?

Two things. First, based on the links in your first post, you probably want your rewrite rule to be this:

RewriteRule ^index/[COLOR=“#FF0000”]language//COLOR/?$ 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.

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:


<li><a href="index.cfm?language=eng" hreflang="en" title="">EN</a></li>

Thank you in advance!!

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?

Hi Robbie. Locally I am running IIS but on the server Apache.

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