开发者

Rewrite rule in WAMP

I am using a WAMP Server. I need to apply rewrite rule for the pages in my local system. I have enabled the rewrite_rule from the WAMP icon at Task bar.

My Website path in local system is http://localhost/Kitty_Enfin/.

http://localhost/Test/index.php -> http://localhost/Test/home
http://localhost/Test/index.php?do=main -> http://localhost/Test/main
http://localhost/Test/index.php?do=profile&uid=1 -> http://localhost/Test/profile/1

Above are the pages I need to rewrite.

My question is: where I need to place the .htaccess file?

  • Whether in www/ or www/Test
  • What is the .htaccess Rewrite rule for the above

It will be more helpful if anyone helps on the Following issue.



Thank you for your reply. When I used the above it not worked for me. But I used another rewrite rule which works for the first two:

RewriteRule ^([^/\.]+)/?$ /\Test/\index\.php [L] - Working (http://localhost/Test, http://localhost/Test/index)

RewriteRule ^([^/\.]+)/?$ /\Test/\index.php?do=$1 [L] - Working (http://localhost/Test/main)

RewriteRule ^profile/([^/\.]+)?$ /\Test/\index.php?do=profile&uid=$1 - Working but the CSS and other scripts are not work here.

And also the links in the pages are http://localhost/Test/profile/ instead of http://localhost/Test/.

Do you have any idea on this is开发者_JAVA技巧sue? Please correct me if I did anything wrong.

Do you have any idea on this issue. Please correct me any thing i did wrong Thanks


RewriteRule ^/?index.php                    home/
RewriteRule ^/?index.php?do=(\w*)           $1/
RewriteRule ^/?index.php?do=(\w*)&uid=(\w*) $1/$2

place the .htaccess in "Test" folder

I can only answer this from your clue

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜