Welcome to WebmasterWorld Guest from 54.226.246.160

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

create wildcard subdomain via htaccess

     

Bayarhuu

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

5+ Year Member



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.

jdMorgan

2:35 am on Jul 15, 2010 (gmt 0)

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



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

ivanvias

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

5+ Year Member



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?

g1smd

6:42 am on Jul 15, 2010 (gmt 0)

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



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").

Bayarhuu

8:54 am on Jul 15, 2010 (gmt 0)

5+ Year Member



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.

jdMorgan

1:41 am on Jul 17, 2010 (gmt 0)

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



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]

g1smd

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

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



Err, you meant 304, not 403 I Assume. :)

jdMorgan

6:00 am on Jul 17, 2010 (gmt 0)

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



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

Jim

ivanvias

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

5+ Year Member



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
 

Featured Threads

Hot Threads This Week

Hot Threads This Month