简而言之,我正在使用的脚本无效
脚本
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ profiles.php?key=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profiles.php?key=$1
原始网址:
http://localhost/profiles?profile_key=yasin%20allana
所需的网址:http://localhost/profiles/yasin%20allana
错误:服务器遇到内部错误或配置错误,无法完成您的请求。
如何更正错误
注意:服务器是v 1.8.3 xampp
完整的htaccess脚本
<IfModule mod_deflate.c>
<FilesMatch "\.(html|txt|css|js|php|pl)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# BEGIN Expires
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>
# END Expires
#override the limit on upload in php
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_input_time 300
php_value max_execution_time 300
答案 0 :(得分:0)
您可以在/profiles/.htaccess
文件中使用此规则:
RewriteEngine On
RewriteBase /profiles/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/.]+)/?$ profiles.php?key=$1 [L,QSA]