我正在使用这两行来重写任何URL,例如www.example.com/spyke(其中spyke是用户名,可以是任何用户名)..在.htaccess中重写URL(文件夹名称为自定义URL,文件夹名称为变量值)
RewriteCond %{REQUEST_URI} ^/([^/]+)? [NC]
RewriteRule ^/([^/]+)? http://www.example.com/index.php?id=82&user=$1 [L,R=301]
这种近乎工作,但该系统目前被重定向到URL是:
www.example.com/index.php?id=82&user=index.php
..而不是
www.mydomain.com/index.php?id=82&user=spyke
1)所以我想重写www.mydomain.com/spyke到www.example.com/index.php?id=82&user=spyke
..有没有人知道如何实现这个?
2)另外,我希望用户在地址栏中看到www.example.com/spyke
而不是www.example.com/index.php?id=82&user=spyke
- 这也可能吗?
谢谢!!!!!
罗埃尔
这里是我的(更新)htaccess文件BTW:
RewriteEngine叙述在
重写规则^/TYPO3 $ - [L] 重写规则^/TYPO3 /.*$ - [L]
RewriteCond%{REQUEST_FILENAME}!-f
的RewriteCond%{REQUEST_FILENAME}!-d
的RewriteCond%{REQUEST_FILENAME}!-l
重写规则。*的index.php
重写规则^ /([A-ZA-Z0-9_- ] +)? http://www.example.com/index.php?id=82&user= $ 1 [L,R = 301]
..
但这只是导致该链接: http://www.example.com/index.php?id=82&user=index
如何将'user'翻译成'id'? – anubhava 2014-10-30 08:42:25
id始终为82;它的“用户”需要变量 – 2014-10-30 09:02:25