Jose Molina
Jose Molina

Reputation: 55

FollowSymlinks .htaccess Rewrite Rule 404 Error

My real URL is:

www.mysite.com/site/index.php

I need:

www.mysite.com/home.html

I write in the .htaccess:

  Options +FollowSymlinks
  RewriteEngine On
  RewriteRule (.*)/home.html$ /site/index.php

But go to 404 Error

Any help?

Tk.

UPDATE:

Have any effect that the domain is actually: www.my-site.com ??

UPDATE:

I save in www.my-site.com and change for this:

<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  RewriteBase /
  RewriteRule ^home\.html$ site/index.php
</IfModule>

But no work.

Upvotes: 0

Views: 2075

Answers (4)

David Off Leons
David Off Leons

Reputation: 11

in my server, i changed on httpd.conf in Apache

AllowOverride None to AllowOverride All

And Work it!

Upvotes: 1

Jose Molina
Jose Molina

Reputation: 55

This site is hosted by godaddy.com, the server run in Windows over IIS, so, the rule have to be write in a web.config file.

<configuration>
 <system.webServer>
   <rewrite>
  <rules>
    <rule name="Imported Rule 1">
      <match url="^home\.html$" ignoreCase="false" />
      <action type="Rewrite" url="site/index.php" />
    </rule>
  </rules>
</rewrite>
 </system.webServer>
</configuration>

Unbelievable!!

Upvotes: 0

Fabian Schmengler
Fabian Schmengler

Reputation: 24551

You said in the comments:

The file .htaccess is save in www.mysite.com/site/

This means, with the current pattern you can access www.mysite.com/site/anything/home.html which will be rewritten to www.mysite.com/site/site/index.php

You should put the .htaccess in the document root and, as already suggested, remove this part from the pattern: (.*)/

Upvotes: 0

kjetilh
kjetilh

Reputation: 4976

The pattern part of the RewriteRule directive matches on the path of the request (eg. /my/request/), the host and query string is not included. Also note that in a .htaccess context the leading slash is not included in the pattern.

  Options +FollowSymlinks
  RewriteEngine On
  RewriteBase /
  RewriteRule ^home\.html$ site/index.php

Upvotes: 1

Related Questions