Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Choosing language  (Read 5630 times)

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« on: May 13, 2007, 02:22:02 AM »

I'm new to http mod_rewrite and I want to do something like this:

http://localhost/sNews/en/category/  or
http://localhost/sNews/ar/category/
instead of
http://localhost/sNews/category/

and in general I want to add a lang variable to my $_GET variable...how can I change this rules:

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php?category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+) index.php?category=$1&title=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+)/([^/]+)/ index.php?category=$1&title=$2&commentspage=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/([0-9]+)/ index.php?category=$1 articlespage=$2 [L]

in .htaccess to  get my desired design?

I suggest sNews add such section to urls. Thanks for your answers.
Logged
Be A Color Pencil For Painting The World !

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« Reply #1 on: May 13, 2007, 02:44:07 AM »

I change in this way and it works fine...I don't know it has bug or not please guide me :

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^([^/]+)/(.*)$ index.php?lang=$1&category=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/(.*)$ index.php?lang=$1&category=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([a-z_]+)/([^/]+) index.php?lang=$1&category=$2&title=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([a-z_]+)/([^/]+)/([^/]+)/ index.php?lang=$1&category=$2&title=$3&commentspage=$4 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([a-z0-9_-]+)/([0-9]+)/ index.php?lang=$1&category=$2 articlespage=$3 [L]
Logged
Be A Color Pencil For Painting The World !

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« Reply #2 on: May 14, 2007, 11:47:24 AM »

No body has No suggestion?!  :(
Logged
Be A Color Pencil For Painting The World !

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Choosing language
« Reply #3 on: May 14, 2007, 07:59:40 PM »

The only possible problem, may be when in the administration area. You will have to test to find out if your admin is still fully functional with this alteration.
Logged
Of all the things I have lost, it is my mind that I miss the most.

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« Reply #4 on: May 15, 2007, 09:48:35 AM »

I have a problem
when I load http://localhost/sNews/en  it leads to page not found
but when I use tailing slash like http://localhost/sNews/en/ and  http://localhost/sNews/en/category or http://localhost/sNews/en/category/title and ... it has no error. how I can solve it?
Logged
Be A Color Pencil For Painting The World !

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« Reply #5 on: May 15, 2007, 11:57:53 PM »

dear keyrocks
can you help me to solve my problem that I said hear? I'm in hurry and Nobody didn't answer  how solve it.
please help me to now how this htaccess works , I know the basics and with the "  var_dump($_GET) " I know what is saved in this ...  but  I didn't understand how add a field of lang to url via htaccess as I described above.
THX alot  ;)
Logged
Be A Color Pencil For Painting The World !

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Choosing language
« Reply #6 on: May 16, 2007, 01:50:05 AM »

Quote from: ght
dear keyrocks
can you help me to solve my problem that I said hear? I'm in hurry and Nobody didn't answer  how solve it.
please help me to now how this htaccess works , I know the basics and with the "  var_dump($_GET) " I know what is saved in this ...  but  I didn't understand how add a field of lang to url via htaccess as I described above.
THX alot  ;)
Unfortunately... neither do I at the moment. I have no experience working or using sNews in a multi-language environment... and my experience with customizing the .htaccess file is about 5% more than that (very little).
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Ghassem Tofighi

  • Full Member
  • ***
  • Karma: 9
  • Posts: 104
    • http://ght.ir
Choosing language
« Reply #7 on: May 16, 2007, 09:41:44 AM »

From who I can ask? who can say me how this htaccess works?
Logged
Be A Color Pencil For Painting The World !

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Choosing language
« Reply #8 on: May 16, 2007, 09:55:56 AM »

Well, Bram is our leading .htaccess expert, but I've not seen him around for a while. Try PM'ing Bramsyuur
Logged
"It's only dead fish that goes with the flow... "
Updated