homepage Welcome to WebmasterWorld Guest from 54.196.207.55
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
create wildcard subdomain via htaccess
Bayarhuu




msg:4170296
 1:04 am on Jul 15, 2010 (gmt 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.

 

jdMorgan




msg:4170324
 2:35 am on Jul 15, 2010 (gmt 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

ivanvias




msg:4170340
 3:00 am on Jul 15, 2010 (gmt 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?

g1smd




msg:4170398
 6:42 am on Jul 15, 2010 (gmt 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").

Bayarhuu




msg:4170448
 8:54 am on Jul 15, 2010 (gmt 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.

jdMorgan




msg:4171905
 1:41 am on Jul 17, 2010 (gmt 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]

g1smd




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

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

jdMorgan




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

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

Jim

ivanvias




msg:4173147
 1:40 am on Jul 20, 2010 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved