1

I want to rewrite following url,

http://example.com/widgets/search.js?id=qerwtwttw45777

as follows,

http://example.com/widgets/search/qerwtwttw45777

and tried following rule in htaccess,

RewriteEngine on
RewriteBase /


RewriteRule search/(.*)/$ /widgets/search.js?id=$1

but it fails and showing

**500 Internal Server Error**

Anybody help to solve this problem. Thanks

2 Answers 2

1

Place this code in /widgets/.htaccess:

RewriteEngine on
RewriteBase /widgets/

RewriteRule ^search/([^/]+)/?$ search.js?id=$1 [NC,L,QSA]
  • Make sure mod_rewrite is enabled.
Sign up to request clarification or add additional context in comments.

Comments

0

Apart from the surplus slash / at the end of the pattern, the rule looks fine. So, it must be some other problem.

Maybe, mod_rewrite isn't active for your website. You could either look into the server's error log, if available or try just

RewriteEngine on

without anything else.

If it still has the 500 Internal server error, rewrite is most likely not available.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.