简体   繁体   中英

.htaccess rewrite from base (http://domain.com/catch-this)

I wonder how I should do accomplish the following.

Catch URL's like the following: http://domain.com/blue-boats send to myfile.php?header=1$

I don't want it to have this structure: http://domain.com/boats/blue-boats

I've tried this, but it doesn't work properly:

RewriteRule /$ myfile.php?header=$1

just put .htaccess in the documentroot of http://domain.com/ with similiar content to the following:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^/([^/]*)/?$ /myfile.php?page=$1 [L] 
</IfModule>

尝试:

RewriteRule (.+) myfile.php?header=$1

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