0

I try to use ModRewrite on my Localhost but basically nothing happens. (Yes, everything in the httpd.conf is set right)

My Dir structure is:

htdocs/project/ this dir contains all files, also the .htaccess

I want to make

127.0.0.1/project/navigation.php to 127.0.0.1/project/navigation.htm

so I've tried this:

RewriteEngine on

RewriteBase /

RewriteRule ^(.*)\.htm$ $1.php [L,R=301]

The navigation.php but when visiting the page a 'rename' to navigation.htm should happen but nothing happens

Someone an idea why?

Michael Brenndoerfer
  • 3,483
  • 2
  • 39
  • 50

1 Answers1

0

Make sure ModRewrite active. Put on Mod Rewrite logging. Check Apache Error and Access log to see that you connected.

Also you asking to redirect php request to static htm pages. But normally people do opposite.

Look here:

.htaccess: rewrite .htm urls internally to .php, but also redirect .php urls to .htm

Community
  • 1
  • 1
Boris Ivanov
  • 4,145
  • 1
  • 32
  • 40
  • Hi, thanks for the hint with the error log. The Error is following: C:/xampp/htdocs/project/.htaccess: Illegal option RewriteEngine - if I remove the line from the .htaccess I get Error 500 - Or does it mean that my RewriteRule is illegal? – Michael Brenndoerfer Jun 11 '13 at 09:25
  • I don't think that I have invisible characters? But I also don't know how to remove them, even if I have them. – Michael Brenndoerfer Jun 11 '13 at 09:34
  • Before you work with ModRewrite make sure .htaccess is activated. http://www.tildemark.com/enable-htaccess-on-apache/ then make sure ModRewrite is installed http://stackoverflow.com/questions/7337724/how-to-check-whether-mod-rewrite-is-enable-on-server – Boris Ivanov Jun 11 '13 at 10:00