我有一个用户可以注册的注册页面。注册后,他们将被重定向到他们的个人资料。重定向是:example.com/profiles/?id=[SOME ID]。这可行,但在我将.htaccess中的URL更改为SEO友好URL后,用户将被重定向到404页面错误,其中未找到其配置文件。实际上,当输入example.com/profiles?id=[SOME ID]时,它们的配置文件确实存在,但是使用example.com/profiles/[SOME ID]它表示配置文件不存在。这是我的.htaccess
<IfModule mod_deflate.c>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
Options -Multiviews
RewriteEngine on
RewriteCond %{THE_REQUEST} /profiles/(?:index\.php)?\?id=([^&\s]+) [NC]
RewriteRule ^ /profiles/%1? [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^profiles/([^/]+)/?$ /profiles/index.php?id=$1 [NC,L]
#Remove .php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [L]
SetOutputFilter DEFLATE
<IfModule mod_setenvif.c>
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</IfModule>
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
动态索引文件是example.com/profiles/,其中profiles文件夹有一个index.php。使用.htaccess消除index.php。如何使example.com/profiles/ [Some ID]返回实际的配置文件而不是404错误?