Pergunta

It's very strange to me, but:

I have a website with guestbook-add.php. I want to show it to the visitors as gasterbuch.html.

So I have written in .htaccess (my real domain has been changed in that listing to http://mywebsite.com/ of course):

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.html$ http://mywebsite.com/index.php [L]
    RewriteRule ^gasterbuch.html$ http://mywebsite.com/guestbook-list.php
    RewriteRule ^eintrag-hinzufugen.html$ http://mywebsite.com/guestbook-add.php
</IfModule>

Now, when I type in the browser http://mywebsite.com/gasterbuch.html, I see the text generated by guestbook-add.php (which is fine).

But in the browser url bar, I see http://mywebsite.com/guestbook-add.php instead of http://mywebsite.com/gasterbuch.html (like it was the 302 redirect).

What am I doing wrong?

Foi útil?

Solução

Changing

RewriteRule ^index.html$ http://mywebsite.com/index.php [L]
RewriteRule ^gasterbuch.html$ http://mywebsite.com/guestbook-list.php
RewriteRule ^eintrag-hinzufugen.html$ http://mywebsite.com/guestbook-add.php

to

RewriteRule ^index.html$ /index.php [L]
RewriteRule ^gasterbuch.html$ /guestbook-list.php [L]
RewriteRule ^eintrag-hinzufugen.html$ /guestbook-add.php [L]

should work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top