.htacces未知的语法错误语法错误、htacces

2023-09-02 11:43:30 作者:猪小哼

有某种方式与我的.htaccess文件中的错误:

 选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME -f .PHP
重写规则^([^ 。] +)$ $ 1.PHP [NC]
的RewriteCond%{REQUEST_FILENAME}&安培; gt;中
重写规则^([^ 。] +)$ profile.php用户= $ 1 [1];?/ pre>
 

但我不知道什么是错的!

我试图做一个永久的连接器。因此,如果用户输入本地主机/ postin'/型材/ username_here它会重定向到与此类似本地主机/ postin的URL/型材/ profile.php?用户= username_here

这是生产的错误是:

  

内部服务器错误

     

服务器遇到一个内部错误或配置错误,   无法完成您的请求。

     

请与服务器管理员联系以admin@example.com通知   他们的这个错误发生的时间,你执行的操作   只是在此之前的错误。

     

这个错误的详细信息,可在服务器错误可用   登录。

解决方案

替换您的规则,试试这个吧。

  RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^型材/([^ /] +)/ $ /profiles/profile.php?user=$1 [L,QSA]
 
网站问题 语法错误

There is somehow a error with my .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.php -f  
RewriteRule ^([^.]+)$ $1.php [NC]
RewriteCond %{REQUEST_FILENAME} >""
RewriteRule ^([^.]+)$ profile.php?user=$1 [L]</pre>

yet I do not know what is wrong!

I am trying to make a permalink connector. So if a user enter "localhost/postin'/profiles/username_here" it will redirect them to a URL similar to this "localhost/postin'/profiles/profile.php?user=username_here"

The error it is producing is:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

解决方案

Replace your rules and try this instead.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profiles/([^/]+)/?$ /profiles/profile.php?user=$1 [L,QSA]