Forum Moderators: phranque

Message Too Old, No Replies

Problem with htaccess in home

         

Max134

12:58 pm on Jan 24, 2011 (gmt 0)

10+ Year Member



Hello

I'm now working in my pc, so to access my web I type:

[localhost...]

I want to make a friendly web, in diferent languages, so I want:

[localhost...] be equivalent to: [localhost...]

when I load files in server it will be:

[mysite.com...] equivalent to: [mysite.com...]

But it doesn't work for me. My htaccess file is:

RewriteEngine on
RewriteRule ([A-Za-z]*)/ index.php?idioma=$1


I try differents ways but it doesn't work properly.

Thanks in advance !

wilderness

1:32 pm on Jan 24, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your question (with the exception of the directories, and even that is asked frequently) is the most common inquiry for assistance in this forum. Sometimes twice in the same day, and by different people, frequently 2-3 times weekly.
There are thousand of similar inquires and answers in the archives.

Try searching the following:
"query strings"
and
question+mark

Max134

6:57 pm on Jan 24, 2011 (gmt 0)

10+ Year Member



I spend the whole day reading manuals, and each time I have a new problem. Now I've resolve index.php, but when I type another page, nothing happens.

Now my code is:


RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ([A-Za-z]*)/ index.php?lang=$1
RewriteRule know/ourcompany/([A-Za-z]*)/ our-company.php?lang=$1
RewriteRule know/ourcompany/ our-company.php


Well, the second page, our-company.php doesnt't work if I delete lines 2 to 5 works. So I wonder what I have to type between line 5 and 6. I try a lot of posibilies, but never works right.

jdMorgan

12:50 am on Jan 25, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to anchor your regular-expressions patterns to avoid ambiguous matching:

RewriteEngine on
#
RewriteRule ^know/ourcompany/$ our-company.php [L]
RewriteRule ^know/ourcompany/([A-Za-z]{2})/$ our-company.php?lang=$1 [L]
RewriteRule ^([a-z]{2})/$ index.php?lang=$1 [NC,L]

Do not waste days and weeks of your time. Go study the regular expressions and mod-rewrite documentation for two days, and save yourself weeks, months, or years of frustration... See our forum Charter for links to a very few very-useful resources.

Jim