Welcome to WebmasterWorld Guest from 54.198.100.0

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

create wildcard subdomain via htaccess

     
1:04 am on Jul 15, 2010 (gmt 0)

New User

5+ Year Member

joined:July 14, 2010
posts:4
votes: 0


Hello everyone,

I have this URL
[vigli.net/account.php?user=someone&action=profile]
and want to redirect to [someone.vigli.net/profile]

But I don't wanna change URL in addressbar so in addressbar the url should be [someone.vigli.net/profile]

What i have to do?

I wrote some htaccess. But Unfortunitly, it affect addressbar, so it's useless for me.

Please Help me, I have some Urgent.
Thanks.
2:35 am on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


As I understand it, the code was:

RewriteCond %{HTTP_HOST} !^www\.example.com [NC]
RewriteCond %{HTTP_HOST} ([^.]+)\.example.com [NC]
RewriteRule ^(.*)$ http://example.com/index.php?user=%1&task=$1 [L]

which specifies an external (URL-to-URL) client redirect.

However, the code should have been something like this:

RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule ^(.*)$ http://example.com/index.php?user=%1&task=$1 [L]

Which is an internal (URL-to-filepath) rewrite.

Jim
3:00 am on July 15, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 22, 2009
posts:92
votes: 0


Okay,

This helps alot, my question now is if on the homepage i write my links to the pages as this subdomain, will it get indexed by search engines?
6:42 am on July 15, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


What you link to "defines" the URL.

The status code returned for that URL defines what search engines do with it.

If it directly returns "200 OK" then it will be indexed.

If it returns some other code then it likely will not be indexed. If it redirects (301, 307) then the URL it redirects to will be indexed (if that other URL returns "200 OK").
8:54 am on July 15, 2010 (gmt 0)

New User

5+ Year Member

joined:July 14, 2010
posts:4
votes: 0


Hello, guys.

Sorry for my bad english.
I couldn't explained well.

Do you know Blogger.com?
Here is blogger link
[http://bayarkhuu.blogspot.com/2007/02/writing-good-content-for-your-blog_11.html]

user is bayarkhuu.
and task is [writing-good... etc.]

I want to stay in address bar (of clients) this URL [http://user.example.com/task] like a Blogger.

P.S: clients will never see any index.php in their address bar.
1:41 am on July 17, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


It would have been quicker to simply test the code. It will likely function as you wish. To verify, use the "Live HTTP Headers" add-on for Firefox, and examine the response codes returned by your server. As g1smd stated above, you should see only 200-OK or 304-Not Modified responses. If you see any other response codes, then there is a problem.

You can also use a user-agent switcher to view your site as it would appear to the major search engines. Or you can use the tools provided by the search engines themselves. For example, Google provides a tool to fetch your page as Googlebot would, and examine the results.

Don't guess at this stuff, or rely on answers posted in forums. Test, test, test!

Jim

[edited by: jdMorgan at 5:58 am (utc) on Jul 17, 2010]

2:24 am on July 17, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Err, you meant 304, not 403 I Assume. :)
6:00 am on July 17, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Yikes! Bit of dyslexia there, I'm afraid.
I fixed it to avoid further propagation - Thanks!

Jim
1:40 am on July 20, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 22, 2009
posts:92
votes: 0


Hi guys,

I am using the following rules on my server.
So when users click on a link example jim.example.com they get redirected to http://example.com/components/mem/site/jim

The component is what does the redirecting to the specific page.

RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/index\.php [NC]
RewriteRule ^(.*)$ /index.php?option=com_fetch_mem&sn=%1 [NC,L]


How can i make it to be this way.

http://example.com/jim