.htaccess strange characters

Custom URLs and redirections.
Fred
Posts: 15
Joined: Mon Feb 04, 2008 6:51 am

.htaccess strange characters

Postby Fred » Tue Apr 14, 2009 2:05 pm

I have been trying to set custom rules in the .htaccess
The rules I had defined did not work, so I reverted to the original auto-generated file with a normal PASV mode FTP transfer... then, some functionalities started failing.

I noticed that URLs were "deformed". Here an example:
http://[my domain]/catalog/index.php?cPath=5_183_186%0F%22ucts_id%3D3476


After a bit of investigation, I found some strange characters in the ftp-uploaded .htaccess file, for instance in the following block:

#index.php - subcategories2 - buy now
RewriteCond %{QUERY_STRING} ^buy=now¤cy=([a-zA-Z]{3})&osCsid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^buy=now¤cy=([a-zA-Z]{3}) [OR]
RewriteCond %{QUERY_STRING} ^buy=now&osCsid=([a-z0-9]*) [OR]
RewriteCond %{QUERY_STRING} ^buy=now
RewriteRule ^([a-z0-9\-]*)-([0-9]*)/([a-z0-9\-]*)-([0-9]*)/([a-z0-9\-]*)-([0-9]*)/([a-z0-9\-]*)-([0-9]*).html$ index.php?cPath=$2_$4_$6"ucts_id=$8&action=buy_now [L,QSA]


Please look the [¤cy] and the ["] ... it appears in other parts of the file, but always in the same place : products, etc.

So I reformated all the ["] (ignoring the [¤cy] cause I do not use "currency" feature in my site), saved and uploaded again. Problem was still here. I downloaded what I had just uploaded, and found again exactly the same bad-writings, in the same place. NOTE : file is indeed rewritten, permissions are ok, I mean there is a real change of the file.

Have you seen that before? Would it do with regenerating all the .htaccess ? What are the risks or possible losses at regenerating? And also, how can I then add custom rules?

Thanks for your help

Fred
Posts: 15
Joined: Mon Feb 04, 2008 6:51 am

Re: .htaccess strange characters

Postby Fred » Wed Apr 15, 2009 4:59 am

Problem solved...

I have no clear explanation, but today I have edited the file in Notepad, made an automatic replace of all strange characters (in currency and products parameter strings), uploaded again (same FTP) and... it works.

I can imagine a text editor is a better idea to edit a .htaccess file, but is there a contraindication for using dreamweaver?