0

I have to to make my URL into a friendly URL.

I have this in my .htaccess file:

RewriteRule http://localhost/test/client/this_is_test_page.php$ http://localhost/test/test-page [NC,R=301,L]

but now I'm getting HTTP 500 internal server error.

What could be causing this, and how can I fix it?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Funti
  • 1
  • 4
  • [HTTP 500](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_Error) is a generic server-side error message. Any time you see this your first step should be to check your error logs for more detail. – ChrisGPT was on strike Dec 23 '17 at 13:56

1 Answers1

0

You should not have HTTP_HOST in your pattern according to the apache documentation :

A RewriteRule consists of three arguments separated by spaces. The arguments are :

  1. Pattern: which incoming URLs should be affected by the rule;
  2. Substitution: where should the matching requests be sent;
  3. [flags]: options affecting the rewritten request.

The Pattern is a regular expression. It is initially (for the first rewrite rule or until a substitution occurs) matched against the URL-path of the incoming request (the part after the hostname but before any question mark indicating the beginning of a query string)

Your rule should be something like :

RewriteRule /test/client/this_is_test_page.php$ /test/test-page [NC,R=301,L]

And you should have mod_rewrite enabled, RewriteEngine On and AllowOverride.

Oulalahakabu
  • 504
  • 3
  • 6