[英]how to use .htaccess to rewrite rule?
i am working on a project which required SEO, for SEO its needed user-friendly URLs, i want to make my url look user-friendly, this is my .htaccess code i want to make my url look like: 我正在一个需要SEO的项目中,对于SEO来说,它需要用户友好的URL,我想让我的URL看起来对用户友好,这是我的.htaccess代码,我想让我的URL看起来像:
http://localhost/footboleh/article/Some-text
while curruntly its look like: 顺带一提,它看起来像:
http://localhost/footboleh/article?url=Some-text
.htaccess code: .htaccess代码:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ article.php?url=$1 [QSA,L]
i had try some rewrite rules which are 我尝试了一些重写规则
RewriteRule ^(.*)$ article.php?url=$1 [QSA,L]
its bring me index page without css and js and giving error in console console error : 它带给我没有CSS和JS的索引页,并在控制台控制台错误中给出了错误:
Uncaught SyntaxError: Unexpected token <
未捕获到的SyntaxError:意外令牌<
and i had print_r ($_GET] its shows: 我有print_r($ _GET]它的显示:
Array ( [url] => article/some-text.php )
数组([url] => article / some-text.php)
You need to exclude your css and js files from the rewrite, usually via: 您需要通过以下方式从重写中排除css和js文件:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
just before your rewriterule line. 就在您的改写行之前。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.