i click the slovak language ikon - with url domain.com/slovak.html - and need to change the url to domain.com/news-sk.html, without to changing the filename? i need capture current filename… or???
Second, your English is far better than my … well, just about any other human language.
Although your basic request seems to be pretty straightforward and your code okay (it can be simplified, though), I’m concerned about your request to redirect the language URI to something Apache can not determine (the page type).
Of course, my basic ranting and raving about the use of lazy regex, the dreaded :kaioken: EVERYTHING :kaioken: atom, to match anything, everything, nothing and just plain garbage. PLEASE, for your own sake, learn some real regex - it’ll save you a lot of problems.
RewriteEngine on
RewriteRule hungarian.html$ main.php?lang=hu [L]
RewriteRule slovak.html$ main.php?lang=sk [L]
RewriteRule ^(news|gallery|contacts|forum|impressum)-(hu|sk)\\.html$ $1.php?page=$1&lang=$2[L]
# Note, this would require that you rename continfo.php
# to contacts.php and main.php to impressum.php
# (or provide a redirect to main after this RewriteRule).
Using regex, you can easily group similar redirects into a single statement. Since you KNOW that you will only have news, gallery, contacts, forum and impressum in the first atom and, presumably, the only languages are hu and sk, specifying these will eliminate NASTY problems when garbage is requested.
That’s what I termed the “Missing Support Files” problem in my signature’s tutorial (and your answers are there about how to resolve it). Please read the tutorial so you can learn how to avoid using (.*) as it’s more trouble than it’s worth (lazy regex).
You didn’t see the Relative Links Are Missing! section? Oh, well, because your showarticle script is told that it’s in the third or fourth subdirectory level, you MUST tell the script itself where it’s located ( <base href=“http://example.com/showarticle.php” /> ). This must be done WITHIN the script’s <head> block. Alternatively, you must use absolute URLs for all your support files and internal links.
Of course it does! Why did you make the redirection absolute rather than the links in the script as I said above (as the less-than-optimum solution - I had given you the <base> tag to begin with). In addition to that, you MUST use a Last flag to terminate a mod_rewrite block statement ELSE it’ll be ANDed with the next block statement! PLEASE read the tutorial linked in my signature - it’s ALL there!