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?
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 :
- Pattern: which incoming URLs should be affected by the rule;
- Substitution: where should the matching requests be sent;
- [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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.