donboe — 2014-02-26T02:39:22-05:00 — #1
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:
- In what folder do i place the .htaccess file? Should that be the httpdocs folder?
- How would I Rewrite this url:
Thank you all in advance!
donboe — 2014-02-26T04:42:55-05:00 — #2
Ok, so I found this article which descibes actually what I am looking for. They suggested to write the following rule:
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.
What am i doing wrong?
jeff_mott — 2014-02-26T16:45:31-05:00 — #3
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.
donboe — 2014-02-27T03:35:41-05:00 — #4
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!!
robbiegod — 2014-03-20T15:08:46-04:00 — #5
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?
donboe — 2014-03-21T04:24:31-04:00 — #6
Hi Robbie. Locally I am running IIS but on the server Apache.
robbiegod — 2014-03-24T10:08:49-04:00 — #7
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: