I am changing my domain from foo.com to foobar.org. I used a Redirect permanent in my apache config file, and then restarted apache. When I try to access the old domain foo.com, I get a 403 error.

This is what my apache config file looks like:

<VirtualHost *:80>
  ServerName foo.com
  #ServerAlias www.foo.com
  #ServerAdmin sysadmin@foo.com
  Redirect permanent / http://www.foobar.org/

  DocumentRoot /path/to/project/foo/web
  DirectoryIndex index.php

  # CustomLog with format nickname
  LogFormat "%h %l %u %t \"%r\" %>s %b" common
  CustomLog "|/usr/bin/cronolog /var/log/apache2/%Y%m.foo.access.log" common

  LogLevel notice
  ErrorLog "|/usr/bin/cronolog /var/log/apache2/%Y%m.foo.errors.log"

  <Directory />
     Order Deny,Allow
     Deny from all

  <Files ~ "^\.ht">
     Order allow,deny
     Deny from all

  <Directory /path/to/project/foo/web>
      Options -Indexes -Includes
      AllowOverride All
      Allow from All

      RewriteEngine On

      # We check if the .html version is here (cacheing)
      RewriteRule  ^$ index.html [QSA]
      RewriteRule  ^([^.])$ $1.html [QSA]
      RewriteCond  %{REQUEST_FILENAME} !-f

      # No, so we redirect to our front end controller
      RewriteRule  ^(.*)$ index.php [QSA,L]

  <Directory /path/to/project/foo/web/uploads>
     Options -ExecCGI -FollowSymLinks -Indexes -Includes
     AllowOverride None
     php_flag engine off

  Alias /sf /lib/vendor/symfony/symfony-1.3.8/data/web/sf
  <Directory /lib/vendor/symfony/symfony-1.3.8/data/web/sf>

#  Alias /sf /lib/vendor/symfony/symfony-1.4.19/data/web/sf
#  <Directory /lib/vendor/symfony/symfony-1.4.19/data/web/sf>
      Options -Indexes -Includes
      AllowOverride All
      Allow from All


Can anyone spot what I may be doing wrong?. The site foobar.org does exist so I don't know why this error occurs - help?

migrated from webmasters.stackexchange.com Dec 1 '12 at 15:39

This question came from our site for pro webmasters.

  • This configuration file is on foo.com and not on foobar.org, right?Then why don't you remove every thing but the redirect permanent inside this .htaccess? Can you access www.foobar.org without getting a 403? – j0k Nov 30 '12 at 9:14
  • mod_alias is activated, isn't it? ("Redirect" = mod_alias stuff, "RewriteXY" = mod_rewrite stuff). – initall Nov 30 '12 at 11:45
  • @j0k: I don't understand your statement. I have removed everything else from the config file. the only two directives are ServerName and the Redirect directive. However, I still get a 403 when I try to access foo.com, but typing foobar.org works ... ?! – Homunculus Reticulli Nov 30 '12 at 21:16
  • @initall: Yes. mod_alias is activated. I don't understand the rest of your comment though, please clarify. – Homunculus Reticulli Nov 30 '12 at 21:56
  • @HomunculusReticulli like j0k said, comment out Redirect permanent / http://www.foobar.org/ and see if you get your old site to display. – Anthony Hatzopoulos Dec 3 '12 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.