I'm trying to rewrite a URL using the following rule:
RewriteRule ^([^/]*)$ /curation.php?id=$1 [L]
and this is an .htaccess file I created:
RewriteEngine On
RewriteRule ^([^/]*)$ /curation.php?id=$1 [L]
but when I push it to my Heroku server, I get a 500 Internal Server Error on all pages. What am I doing wrong?
Thanks
I think the main problem is you rewrite rule
try something like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([^/]+) index.php?id=$1 [L]
</IfModule>
If you have mod_rewrite loaded, and your rules are in an htaccess file in your document root. The rules that you have are causing an infinite loop. You need to add a condition or two to prevent that:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/curation\.php
RewriteRule ^([^/]*)$ /curation.php?id=$1 [L]
Or
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)$ /curation.php?id=$1 [L]
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.