RewriteEngine on Options +FollowSymlinks AddDefaultCharset UTF-8 #Strip trailing slash #RewriteCond %{REQUEST_URI} !\.(css|jpg|gif|js)$ #RewriteRule ^(.*)\/$ /web/$1 [R=301] #rewriteCond %{REQUEST_URI} /$ #rewriteRule ([^./]+)/$ /web/$1 [R=301] #Remove extensions from files except on index.php, images, javascript files and pdfs RewriteCond %{REQUEST_URI} !index.php RewriteCond %{REQUEST_URI} !\.(css|jpg|gif|js)$ RewriteRule ^(.*)\.(.*)$ /web/$1 [R=301] #Rewrite the virtual pages to form index.php can use RewriteCond %{QUERY_STRING} !marker RewriteCond %{QUERY_STRING} id=([-a-zA-Z0-9_+]+) RewriteRule ^/?index\.php$ %1? [R=301,L] RewriteRule ^/?([-a-zA-Z0-9_+]+)$ /web/index.php?marker&page=$1 [L] #If a page isn't found, send it to index.php also ErrorDocument 404 /web/index.php