我需要像这样转换一个查询字符串:
HTTP://localhost/view.php ID = 12345
进入:
但是,我还计划在URL的末尾添加一个字符串,以便搜索引擎受益,如下所示:
HTTP://本地主机/ 12345/NameOfTheSkin
有点像Wowhead如何做他们的URL:
http://www.wowhead.com/item=49623/shadowmourne
Run Code Online (Sandbox Code Playgroud)
请注意如何将字符串"shadowmourne"更改为任何内容,它仍将指向项ID 49623
.
基本上,我需要忽略最后的字符串.
欢迎任何帮助,欢呼.:)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA
Run Code Online (Sandbox Code Playgroud)
寻找反馈
目标:我正在尝试在Drupal 7站点上启用"Clean URL"(例如example.com/?q=user解析为example.com/user).
我刚刚花了太长时间通过官方Drupal文档和评论,无济于事,所以任何建议都非常感谢!
我在Drupal(/ admin/config/search/clean-urls)中选中了"启用清洁URL"框,并清楚地知道配置选项已保存.所以现在我实际上可以访问example.com/user,它确实显示与example.com/?q=user相同的内容.但是,我想要的是,例如,在/x.q = user中,可以在URI中重写为example.com/user.
相关的.htaccess代码如上所示,我的Apache conf似乎已正确配置.
I did not find any good answer to this question so I share what I found and works
if you want to remove all the google analytics terms from an URL, you mostly want to keep the other parameters and get a clean valid URL at the end
url = url.replace(/(\&|\?)utm([_a-z0-9=+\-]+)/igm, "$1");
Run Code Online (Sandbox Code Playgroud)
with a url like this
https://www.somewebsite.fr/produit/yi-camera-3600-noir-vr-33705370/offre-81085802?utm_source=325483&utm_medium=affiliation&utm_content=catalogue-RDC&awc=6901_1530705916_88ef12642ad61dfc5239ba01bbbe5249
you will get this https://www.somewebsite.fr/produit/yi-camera-3600-noir-vr-33705370/offre-81085802?&&&awc=6901_1530705916_88ef12642ad61dfc5239ba01bbbe5249
this url is already valid but we have some dupe & signs if you remove the $1 …
我已经查看了几篇关于设置“漂亮 URL”的文章,但我似乎无法找到任何对我有用的东西。我是整个 .htaccess 过程的新手,似乎我所看到的一切都是面向动态的、基于 .PHP 的站点。这是我希望看到的:
丑网址:http : //www.example.com/test.html
漂亮网址:http : //www.example.com/test/
它目前在 .htaccess 文件中尝试使用的是:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+)$ $1.html
Run Code Online (Sandbox Code Playgroud)
到目前为止,我没有运气。我没有在页面上使用任何形式的 .php - 这些是静态的 .html 页面。任何帮助将不胜感激。谢谢!
我想用自己的CMS建立一个网站,但我遇到了漂亮网址的问题.如果看到http://mysite/page.php,我希望用户看到http:// mysite/page.它有点像wordpress自定义模板.在此先感谢您的帮助.
clean-urls ×5
.htaccess ×4
apache ×1
drupal-7 ×1
friendly-url ×1
javascript ×1
node.js ×1
php ×1
pretty-urls ×1
regex ×1
rewrite ×1
url ×1