这在localhost上工作正常:

#The RewriteEngine directive enables or disables the runtime rewriting engine.
RewriteEngine On

#This won't allow any folder to be accessible  if it's not having an index.php file
Options All -Indexes

#This will redirect user to http://localhost/awe/ if 404 or 403 error comes
ErrorDocument 404 http://192.168.1.6/app/
ErrorDocument 403 http://192.168.1.6/app/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

同样在Godaddy.com服务器上给我错误: Error 500

当我删除 Options All -Indexes 它用于显示第一页作为index.php存在但不显示内部页面并显示 404 错误,因为它在我的 Bootstrap 下定义 . 请注意需要做什么 .

此外,我已将其放入我的一个子域和一个文件夹中:所以我的应用程序的路径是这样的:

http://mysubdomain.mywebsite.com/myprojectname/app

所以我的 .htaccess 文件只放在这个文件夹中 http://mysubdomain.mywebsite.com/myprojectname/app