I have installed a php script in a subfolder in my web host and there is a query string that I want it to be changed to SEO friendly URL.
The way it is now:
http://example.com/payment/index.php?link=AhYBksPI123
and the way I want:
http://example.com/payment/AhYBksPI123/
I have used some .htaccess
rules and every time I got 500 internal server error.
Note: There is open cart installed in the root folder of the web site and there is no .htaccess file in the root folder and I just put the .htaccess
file in to the /payment/
subfolder. Of course, I tested putting .htaccess
file in to the root folder, but still getting the same error.
This is one of the test codes I have used putting it to the root:
RewriteEngine on
RewriteBase /payment/
RewriteCond %{THE_REQUEST} /index(?:.php)??link=([^s&]+)s [NC]
RewriteRule ^ %1/? [R=302,L,NE]
I don’t know what am I doing wrong?!
I don’t know if this is the error log that would be useful or not:
[Tue Dec 08 12:44:11.722999 2015] [core:alert] [pid 2871:tid
140185601808128] [client 5.161.54.254:60365] /path/to/root/payment/.htaccess: Invalid command
‘xefxbbxbfRewriteEngine’, perhaps misspelled or defined by a module
not included in the server configuration [Tue Dec 08 12:21:18.328407 2015] [core:alert] [pid 30874:tid
140185509488384] [client 5.161.54.254:46771] /path/to/root/.htaccess:
Invalid command ‘xefxbbxbfRewriteEngine’, perhaps misspelled or
defined by a module not included in the server configuration
2
Answers
Try this:
You have some invisible characters in front of the commands:
xefxbbxbf
. Remove them or, if you can’t see them, rewrite the file to make sure they are gone.