简体   繁体   中英

htaccess redirect url to page

I want to redirect a particular page using a 301 but my htaccess is also redirecting pages that contain the same start.

Example:

I want to redirect:

http://domain.com/advantage

To:

http://domain.com/index.php?page=some advantage

My current rule is

RewriteRule ^advantage "index.php?page=some advantage" [L,R=301]

This rule also redirects

http://domain.com/advantage-form.php

To the "some advantage" page

How do I fix this?

^advantage should be ^advantage$

ie Instead of "Start, then advantage" it should be "Start, then advantage, then End".

This site is an expert on using mod_rewrite. Have a look at it. He is got lot of resources, if you are dealing with lot of rewrite rules. However whatever David said should work for the above question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM