开发者

Localization parameter as a subdirectory in the url. How to take into account the redirection in html?

The idea is to redirect http://thesite.com/fr/page1.htm to http://thesize/page1.htm?lang=fr

I could find around how to set .htaccess and redirection is working with this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQU开发者_开发技巧EST_FILENAME} !-d
RewriteRule ^fr/([^/]+)$ /$1?lang=fr [L,QSA]

But the problem I can not find a solution is from the redirected page itself. The paths to folders seem to be relative to the subdirectory /fr as to html it looks like it is in the subdirectory fr. What would be a clean solution for this? a in the on each page?

Thanks!


I'd say using an absolute path is the way to go in this case.

  • Adding <base> leads to other problems, because it changes the relative root for the whole page
  • Using relative paths is too tiresome if you have multiple possible levels of sub-directories.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜