Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Problem: with Mod_rewrite, multiview & Apache config

Introduction: The website is in french and i had problem with unicode encoding and mod_rewrite within php wihtout multiviews

  • Old server was not handling utf8 correctly (somewhere between PHP, apache mod rewrite or mysql)
  • Updated Server to Ubuntu 11.04 , the process was destructive
    • lost all files in var/www/ (the site was mainly 2 files index.php & static.php)
    • lost the site specific .Htaccess file
    • lost MySQL dbs
    • lost old apache.conf

What i have done so far:

What works:

  • Setup GNutls for SSL, Listen 443 => port.conf
  • Created 2 Vhosts in one file for :80 and :443 => website.conf
  • Enforce SSL => Redirecting :80 to :443 with a mod_rewrite redirect
  • Tried to set utf-8 everywhere.. Set charset and collation , db connection , mb_settings , names utf-8 and utf8_unicode_ci, everywhere (php,mysql,apache)
  • to be sure to serve files as UTF-8 i enabled multiview
  • renamed and
  • With multiview enabled, Multibytes Accents in URL works
  • SSL TLS 1.0

What dont work:

  • With multiview enabled , mod_rewrite works for only one of my rewriterules
  • With multiview Disabled, i loose access to the document root as "Forbidden"
  • With multiview Disabled, i loose Multibytes (single charater accent)
  • The Apache Default server is full of settings. (what can i safely remove ?)

these are my configuration files so far

:80 Vhost file (this one work you can use this to force redirect to https)

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
LanguagePriority fr

:443 Vhost file (GnuTls is working)

DocumentRoot /var/www/x
<Directory "/var/www/x">
 allow from all                             
 Options FollowSymLinks +MultiViews  
 AddLanguage fr .fr   
 AddCharset UTF-8 .utf8 
 LanguagePriority fr
GnuTLSEnable on                             
GnuTLSCertificateFile /path/to/certificate.crt
GnuTLSKeyFile /path/to/certificate.key
<Directory "/var/www/x/base">

Basic .htaccess file

 AddDefaultCharset utf-8
 Options FollowSymLinks +MultiViews
 RewriteEngine on
 RewriteRule ^api/$  /  [L,NC,R]
 RewriteRule ^contrib/$ /  [L,NC,R]
 RewriteRule ^coop/$  /  [L,NC,R]
 RewriteRule ^crowd/$  /  [L,NC,R]
 RewriteRule ^([^/]*)/([^/]*)$ /$2&VALUETWO=$1 [L]

So my quesiton is whats wrong , what do i have missing is there extra settings that i need to kill from the apache default . in order to be sure all parts are using utf-8 at all time, and that my mod_rewrite rules work with accent

Thank you all in advance for your help, I will follow this question closely , to add any needed information.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.