我对重写规则有一些困难。我的.htaccess
样子是这样的:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule admin/add-category$ adm_add_category.php [NC]
RewriteRule admin/categories-management$ adm_categories_management.php [NC]
RewriteRule admin/user-settings/(.*)$ adm_user_settings.php?update=$1 [NC]
RewriteRule admin/website-settings/(.*)$ adm_website_settings.php?update=$1 [NC]
RewriteRule admin/users-management$ adm_users_management.php [NC]
RewriteRule admin/websites-management$ adm_websites_management.php [NC]
RewriteRule settings/profile$ changesettings.php [NC]
RewriteRule settings/websites$ my_websites.php [NC]
RewriteRule settings/password$ changepassword.php [NC]
RewriteRule settings/logout$ logout.php [NC]
RewriteRule pages/index$ index.php [NC]
RewriteRule pages/access$ access.php [NC]
RewriteRule pages/submit-url$ submit_url.php [NC]
RewriteRule pages/online-users$ online_users.php [NC]
RewriteRule pages/register$ register.php [NC]
RewriteRule pages/websites$ websites_list.php [NC]
RewriteRule pages/websites/(.*)$ websites_list.php?page=$1 [NC]
RewriteRule pages/contact$ contact.php [NC]
RewriteRule search/(.*)$ search.php?term=$1 [NC]
RewriteRule category/(.*)$ category.php?name=$1 [NC]
RewriteRule profile/(.*)$ profile.php?username=$1 [NC]
RewriteRule website/(.*)$ website.php?name=$1 [NC]
除以下内容外,所有重写均有效:
RewriteRule search/(.*)$ search.php?term=$1 [NC]
RewriteRule category/(.*)$ category.php?name=$1 [NC]
RewriteRule profile/(.*)$ profile.php?username=$1 [NC]
RewriteRule website/(.*)$ website.php?name=$1 [NC]
尝试加载特定配置文件(例如 /profile/exampleguy)时,会显示 404 错误。有谁知道这会导致什么?
404 看起来像:
The requested URL /profile/exampleguy was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
如果您需要更多信息,请告诉我,我非常感谢您的帮助!