Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I18N + News Manager = htaccess RewriteRules?
#1
Maybe someone has had this issue or posted previously.
I'm using I18N for international languages and the News Manager, however, I'm having trouble getting the correct htaccess RewriteRules to satisfy the News Manager posts using Fancy URLs.

Example looks fine @: domain.com/en/news/
Example breaks @: domain.com/en/news/post/example-news-post
when clicking news link, and get (We are sorry, but the page you are looking for does not exist.)

Custom Permalink Structure:
%language%/%parent%/%slug%/

Current .htaccess file looks like:
RewriteBase /

RewriteRule ^/?$ en/ [R,L] # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|lt)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(en|lt)/?$ index.php?lang=$1 [QSA,L]
RewriteRule ^news/tag/([^/.]+)/?$ index.php?id=news&tag=$1 [L]
RewriteRule ^news/post/([^/.]+)/?$ index.php?id=news&post=$1 [L]
RewriteRule ^news/page/([^/.]+)/?$ index.php?id=news&page=$1 [L]
RewriteRule ^news/archive/([^/.]+)/?$ index.php?id=news&archive=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

I'm certain it's a simple fix and have tried a few variations but can't get it to work correctly.
Any suggestions..?
Reply
#2
I also got to this situation today.

I set up custom permalink structure, which is
Code:
%language%/%parent%/%slug%/

My previous .htaccess file looked like this (Fancy URLs on even in the News Manager)
Code:
RewriteEngine on

# Usually RewriteBase is just '/', but
# replace it with your subdirectory path
RewriteBase /demo/testTeeJay/plus/

# News Manager:
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# end News Manager

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

When setting up the I18N custom permalink structure to have adresses like...
Code:
myaddress.com/en/news/
...I had to change the bottom part of the .htaccess, so now I have... (clanky = articles or news)
Code:
# News Manager nastaveni:
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# end News Manager

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

RewriteRule ^/?$ cs/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(cs|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(cs|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9-]+)/?$ index.php?id=$1 [QSA,L]

However, the articles don't work. The can't show up, there is an error that the requested article couldn't be found. I think there is a language variable needed in front of "clanky/" in the News Manager text field. Interesting is that in the setup of the News Manager there is no more the option for Fancy URLs.

Thanks Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply




Users browsing this thread: 1 Guest(s)