[英]htaccess error 500 if empty variable (php)
/product/blabla is ok /product/ give a "500 internal error" /product/blabla 没问题 /product/ 给出“500 内部错误”
RewriteRule product/([0-9a-zA-Z]+) product.php?c=$1 [L]
if ($_GET['c']){
....
}
else{
?>
<script>document.location.href="<?=$racine;?>"</script>
<?
}
Try this尝试这个
RewriteRule product/([0-9a-zA-Z]+) product.php?c=$1 [L]
RewriteRule product/ product.php [L]
if (isset($_GET['c'])){
....
}
else{
?>
<script>document.location.href="<?=$racine;?>"</script>
<?
}
I think this may help you.我想这可能对你有帮助。
Rewrite your .htaccess
to将您的.htaccess
重写为
RewriteRule product/^$|([0-9a-zA-Z]+) product.php?c=$1 [L]
^$|([0-9a-zA-Z]+) will check for empty string or a string. ^$|([0-9a-zA-Z]+)将检查空字符串或字符串。 So product/
too will work所以product/
也将起作用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.