开发者

Simple Mod_rewrite rule for a simple website (Classic) :(

I have been making my own little website with a small CMS. And i just can't get mod_rewrite to work for me, what i'm after seems simple and straightforward. Right now my links look like this: localhost/cms/?page=history, localhost/cms/?news=galery-module etc.. I want them to look like this: lo开发者_运维百科calhost/cms/page/history

The code in my .htacess file right now is(but it does not seem to work although MOD_rewrite is on):

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule /cms1/([-A-z0-9]+) /cms1/?page=$1

Thank you for your help!


This should work:

Options +FollowSymLinks

RewriteEngine on

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule /cms1/([a-zA-Z0-9-]+)/?([a-zA-Z0-9-]*) /cms1/?$1=$2

Also note that I wrote cms1 and not cms, it was in your rules but not in your urls, adjust accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜