开发者

Point a virtual sub domain to a folder - error

I have a domain name www.jannatband.com, when I access the url:

http://jannatband.com/me/asd

It successfully echoes the value asd, the original url is like:

http://jannatband.com/me/index.php?u=asd

HTACESS CODE FOR THE ABOVE:

# .h开发者_开发知识库taccess
RewriteEngine on
RewriteRule ^[aA-zZ]+$ index.php?u=$0

but when I try to convert the same url to

http://me.jannatband.com/asd

using this .htaccess code:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^me\.jannatband\.com$
RewriteCond %{REQUEST_URI} !^/me/
RewriteRule (.*) /me/$1

Its giving me a This webpage is not available error. What is wrong with this .htaccess code?

PS: the /me/ is an existing directory in the public_html.


You rewrite rules will change the URL once in your case. But you want to make the rewrite engine to work on the changed URL once again.

You can say so by specifying a flag, the next flag. From the manual:

'next|N' (next round) Re-run the rewriting process (starting again with the first rewriting rule). This time, the URL to match is no longer the original URL, but rather the URL returned by the last rewriting rule. This corresponds to the Perl next command or the continue command in C. Use this flag to restart the rewriting process - to immediately go to the top of the loop.

So be careful when you enable it:

RewriteRule (.*) /me/$1 [N]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜