简体   繁体   English

.htaccess从基础(http://domain.com/catch-this)重写

[英].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$ 捕获URL,如下所示: http ://domain.com/blue-boats发送到myfile.php?header = 1 $

I don't want it to have this structure: http://domain.com/boats/blue-boats 希望它具有以下结构: 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: 只需将.htaccess放在http://domain.com/的documentroot中,其内容类似如下:

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

尝试:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用参数将htaccess从domain.com重定向到domain.com - Htaccess redirection from domain.com to domain.com with parametrs .htaccess将domain.com重定向到domain.com/ - .htaccess redirect domain.com to domain.com/ http to https AND //domain.com to www.domain.com AND subdomain.domain.com to subdomain.domain.com through htaccess - http to https AND //domain.com to www.domain.com AND subdomain.domain.com to subdomain.domain.com through htaccess 从http://domain.com切换到http://www.domain.com时,PHP会话丢失 - PHP Session lost when switching from http://domain.com to http://www.domain.com SSL错误:如何通过.htaccess将https://www.domain.com重定向到http://domain.com以避免SSL错误 - SSL Error: how to redirect https://www.domain.com to http://domain.com via .htaccess to avoid SSL error RewriteRule不适用于根网址(http://domain.com),但适用于具有路径(http://domain.com/foo)的网址 - RewriteRule not working on root url (http://domain.com) but works for urls with path (http://domain.com/foo) 在PHP中从.domain.com删除Cookie - Delete cookies from .domain.com in PHP .htaccess重定向断开的链接domain.com/.php - .htaccess redirect a broken link domain.com/.php Htaccess不会将移动用户重定向到domain.com/m - Htaccess does not redirect mobile users to domain.com/m htaccess将domain.com重定向到www.domain.com,但多个域的staging.domain.com除外 - htaccess redirect domain.com to www.domain.com except of staging.domain.com for multiple domains
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM