Apache Htaccess重写漂亮的URL
我的问题可能有一个非常简单的答案,但经过几个小时的浏览,我仍然没有找到解决方案,所以非常感谢您的帮助。也许我应该提到,我正在使用Bluehost的子域(同一帐户上有多个域) 我想重写:www.example.com/myfolder 到www.example.com/index.php?s=myfolderApache Htaccess重写漂亮的URL,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,我的问题可能有一个非常简单的答案,但经过几个小时的浏览,我仍然没有找到解决方案,所以非常感谢您的帮助。也许我应该提到,我正在使用Bluehost的子域(同一帐户上有多个域) 我想重写:www.example.com/myfolder 到www.example.com/index.php?s=myfolder RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENA
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ /index.php?s=$1 [L]
- example.com/abcd->works
- example.com/abcd/->可以正常工作,但会破坏我的图片URL
- example.com/abcd/index.php->不起作用(重定向我) (至主页)
重写规则^/?此处有一些文本/([0-9]+)$/picture.php?id=$1要重写为索引,请使用:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/?$ /index.php?s=$1 [L]
对于css、脚本或图片,请使用绝对链接(以/
或开头)http://...
)或在html头中添加