0

i have a website. A part of the website is wordpress the other part is without a CMS. I use the following .htaccess for my website. But the URLs which came from the "none cms-part" ( which have the slug /expose/ID ) of the website are accessible with and without www. When i use a rewrite Cond rule i get a 500 Servererror

i used the following rewrite rule:

RewriteCond %{HTTP_HOST} ^mydomain\.de$

RewriteRule ^(.*)$ http://www.mydomain/$1 [R=permanent]

And here is my complete htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*?[^/])$ %{REQUEST_URI}/ [L,R=301,NE]
RewriteRule ^unternehmen-2-2/?$ /unternehmen [L,R=301,NC]
RewriteRule ^expose/(.*)/$ content/index.php?content=expose&query=$1 [L,QSA]

</IfModule>


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I Hope somebody can help me that the urls with the slug /expose/id are only accessible with www

tom84
  • 371
  • 1
  • 3
  • 15
  • please search first http://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess – coyote34 Sep 08 '16 at 09:56
  • when i use the code from the other post i also get a 500 error. On which place i have to put the code in my htaccess? – tom84 Sep 08 '16 at 11:29
  • no ideas? When i use this code RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] i alos get a 500 error – tom84 Sep 09 '16 at 07:43

1 Answers1

0

Please try this.This is working on my site.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
coyote34
  • 51
  • 4