0

i have already search for a long time and i could not figure our why Rewrite Rule is not working. i want to translate this url

http://localhost/uniwood/template-allgemein.html?postname=kontakt&pageid=27

to

http://localhost/postname/kontakt.html

here the code in the htaccess file

RewriteEngine On
RewriteRule ^postname/([^/]*)\.html$ /uniwood/template-allgemein.html?postname=$1&pageid=27 [L]

I'am using locally on my machine the mamp pro webserver and checked that AllowOverride is on "all".

I do not get any mistakes! Also no error logs!

thanks!

miholzi
  • 922
  • 1
  • 14
  • 36

1 Answers1

0

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{THE_REQUEST} /template-allgemein\.html\?postname=([^\s&]+)&pageid=27 [NC]
RewriteRule ^ /postname/%1.html? [R=302,L,NE]

RewriteRule ^postname/[^.]+)\.html$ /template-allgemein.html?postname=$1&pageid=27 [L,NC,QSA]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • thanks for your answer, but now i get the path of the installation directory of the the mamp in the url http://localhost/Applications/MAMP/htdocs/postname/kontakt.html – miholzi Feb 18 '15 at 12:38
  • is there a bracket missing in the last line? – miholzi Feb 18 '15 at 13:11
  • I have updated the rules. Try updated ones and make sure they are in root .htaccess – anubhava Feb 18 '15 at 14:03