繁体   English   中英

htaccess RewriteCond for RewriteRule除了

[英]htaccess RewriteCond for RewriteRule everything except of

我需要设置以下情况:

我需要将/ Login或/ Start之类的URL重定向到core.php?fn=Login or core.php?fn=Start

但是每当我输入类似/profile_id smth时,我都希望将其重定向到profile.php?profile_id=profile_id

RewriteRule ^(.*)$ /core.php?fn=$1抛出500错误。

我该如何设置那个?

通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在DOCUMENT_ROOT目录下的.htaccess

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(Login|Start)/?$ core.php?fn=$1 [L,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ profile.php?profile_id=$1 [L,QSA,NC]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM