0

i know this question is asked like a million times, but i can't seem to get it to work.

what i want is when i type the url localhost:8080/contact that it loads the localhost:8080/sample/index.php?option=com_content&view=article&id=3 page.

i have tried the following:

RewriteCond %{REQUEST_URI} contact RewriteRule ^^([-\w\.])$ sample/index.php?option=com_content&view=article&id=3 [NC,L]

but now when i do localhost:8080/contact i see the WAMP server homepage instead of the contact page.

also tried this: RewriteRule ^contact/?$ sample/index.php?option=com_content&view=article&id=3 [NC,L]

but that gives errors for some reason.

rewrite engine is on: RewriteEngine On and apache rewrite module is on.

what am i doing wrong here?

Kevin Kloet
  • 121
  • 1
  • 7
  • http://serverfault.com/questions/214512/redirect-change-urls-or-redirect-http-to-https-in-apache-everything-you-ever covers all of this (and if you've already worked through that, you should demonstrate it). An obvious issue with the rule is that the pattern you're matching REQUEST_URI against should start with a `/` - so `/contact` rather than `contact`. – Paul Haldane Oct 18 '16 at 10:17
  • There is no anchor, so a pattern of `contact` will still match. Of course that might still be wrong, but it *will* match. One other problem is `^^` at the start. Without testing myself I've no idea if that will do anything. – Unbeliever Oct 18 '16 at 10:35

1 Answers1

0

I have found the answer, after trying all the possibilities this is what worked:

RewriteRule contact/?    /sample/index.php?id=3   [L,NC]

No conditions seem to work perfectly.

MrWhite
  • 11,643
  • 4
  • 25
  • 40
Kevin Kloet
  • 121
  • 1
  • 7