0
所以我有這個.htaccess爲我重寫了一個URL,但它一直沒有工作。'RewriteEngine'命令無效,可能是拼寫錯誤或未包含在服務器配置中的模塊定義的
如果我檢查var/logs/apache2/error_log
,它說: -
[[Sun Jul 16 18:22:28.958099 2017] [core:alert] [pid 4237] [client ::1:54344] /Library/WebServer/Documents/getcv/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
可能是什麼問題?我甚至在httpd.conf中啓用rewrite_module
LoadModule request_module libexec/apache2/mod_request.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule filter_module libexec/apache2/mod_filter.so
這裏的的.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /foldername/
RewriteCond %{THE_REQUEST} /my_profile\.php\?username=([^\s&]+) [NC]
RewriteRule^%1? [R=301,L,NE]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([\w-]+)/?$ my_profile.php?username=$1 [L,QSA]
你甚至讀過我的問題嗎? – RinSupreme
問題中的第二句話:「我甚至在httpd.conf中啓用了rewrite_module」 – chrki