Php htaccess RewriteCond for RewriteRule除
我需要设置以下场景: 我需要将类似于/Login或/Start的URL重定向到Php htaccess RewriteCond for RewriteRule除,php,.htaccess,mod-rewrite,rewrite,Php,.htaccess,Mod Rewrite,Rewrite,我需要设置以下场景: 我需要将类似于/Login或/Start的URL重定向到core.php?fn=Login或core.php?fn=Start 但是每当我输入smth时,比如/profile\u id我希望它被重定向到profile.php?profile\u id=profile\u id RewriteRule^(.*)$/core.php?fn=$1 它抛出一个500位的错误 如何设置该选项?通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在文档
core.php?fn=Login或core.php?fn=Start
但是每当我输入smth时,比如/profile\u id
我希望它被重定向到profile.php?profile\u id=profile\u id
RewriteRule^(.*)$/core.php?fn=$1
它抛出一个500位的错误
如何设置该选项?通过
httpd.conf
启用mod_rewrite和.htaccess,然后将此代码放在文档根目录下的.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]
请添加一些代码和.htaccess的内容谢谢,但它只能部分工作。第二个改写器会杀死像/API/StudiMyPosits之类的东西,如果这个答案帮助你解决了你的问题,请考虑把它标记为“被接受”,这样在将来面对类似问题的用户将能够很容易地看到它。