[英]Htaccess Rewrite Pretty URL
there's probably a very simple answer to my question, but after hours of browsing I still haven't found a solution, so thank you very much for all your help.我的问题可能有一个非常简单的答案,但经过数小时的浏览,我仍然没有找到解决方案,因此非常感谢您的帮助。 Perhaps I should mention that I'm using a subdomain with Bluehost (multiple domains on the same account).
也许我应该提到我正在使用 Bluehost 的子域(同一帐户上的多个域)。
I would like to rewrite: www.example.com/myfolder to www.example.com/index.php?s=myfolder我想重写: www.example.com/myfolder到www.example.com/index.php?s=myfolder
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /index.php?s=$1 [L]
Thank you very much for your help.非常感谢您的帮助。 Roland
罗兰
Have you checked this: https://aloneonahill.com/blog/url-rewriting-for-beginners你检查过这个: https : //aloneonahill.com/blog/url-rewriting-for-beginners
and: URL rewriting with PHP和: 用 PHP 重写 URL
RewriteEngine on RewriteRule ^/?Some-text-goes-here/([0-9]+)$ /picture.php?id=$1 RewriteRule 上的 RewriteEngine ^/?Some-text-goes-here/([0-9]+)$ /picture.php?id=$1
To rewrite to index, use:要重写为索引,请使用:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/?$ /index.php?s=$1 [L]
And for css, scripts, or pictures, use absolutes links (which begin with /
or http://...
) or add <base href="/">
in html head.对于 css、脚本或图片,请使用绝对链接(以
/
或http://...
开头)或在 html 头中添加<base href="/">
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.