Mod rewrite 使用.htaccess更改URL
例如,我想更改url http://localhost/mysite/index.php?page=about 将成为 http://localhost/mysite/index/about 我还使用了Mod rewrite 使用.htaccess更改URL,mod-rewrite,Mod Rewrite,例如,我想更改url http://localhost/mysite/index.php?page=about 将成为 http://localhost/mysite/index/about 我还使用了RewriteRule^index/(.*)/index.php?page=$1,如果我键入 http://localhost/mysite/index/about在URL栏中,然后它重定向到 http://localhost/xampp/splash.php,显示XAMPP工作正常的页面 还启用
RewriteRule^index/(.*)/index.php?page=$1
,如果我键入
http://localhost/mysite/index/about在URL栏中,然后它重定向到
http://localhost/xampp/splash.php,显示XAMPP工作正常的页面
还启用了一个think more mod_rewrite
如果我使用
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs
RewriteRule ^index/(.*)$ index.php?page=$1 [PT,L]
它显示正确的页面,但不添加样式表,也不显示图像和jQuery文件。
和Firebug显示不同错误的数量,例如:
任何指南…?指定为脚本、图像和样式表调用的文件的完整路径,如
<link type="text/stylesheet" src="http://www.example.com/styles/main.css" />
<script type="text/javascript" src="http://www.example.com/scripts/jquery-min.js"></script>
<script type="text/javascript" src="http://www.example.com/scripts/jquery-slider.js"></script>
您的服务器中是否启用mod_rewrite?谢谢Coosal,它真的很完美,但是如果它对SEO有负面影响,你可以指导我吗?不,它不会对SEO有负面影响。事实上,url重写是SEO友好的。所以你不必担心:)