How to call example.domain.com instead of www.domain.com/example - apache

I've seen many website doing this, for example in the address bar : we can type: someuser.twitter.com and it will automatically redirect us to twitter.com/someuser
I know this can be done using HTACCESS. Could some one help me please on what to write on the htaccess file in order to call example.domain.com instead of domain.com/example ?
Thank-you in advance

Look at this well explained topic:
http://stackoverflow.com/questions/586129/create-subdomains-on-the-fly-with-htaccess-php

Related

Yii2 url is to long so I receive a 403 code

Is there any setting for url limit in Yii 2?
Some of my urls are over 300 characters and I get a 403 Forbidden code;
http://website/servicii-de-proiectare-asistenta-tehnica-din-partea-proiectantului-pe-perioada-derularii-lucrarilor-si-executie-de-lucrari-pentru-proiectul-%E2%80%9Emodernizare-drumuri-comunale-dc----dc----si-dc---a-de-pe-raza-comunei-lunca-judetul-boto-ani%E2%80%9D-863506-switch.html
If I shorten the url, it works.
this is my urlmanager rule:
'<title:(.*)>-<id:([0-9]+)>-access-not-granted.html' => 'member/licitatii/access-not-granted',
I tried to find some information regarding this issue and surprisingly enough, I didn't found a thing regarding URL length permitted.
However, I found a Yii way to solve your issue: Short URL Yii extension presented here - http://www.yiiframework.com/extension/google-url-shortener/
Also, please read this documentation that better explains how Yii treats URL routs: http://www.larryullman.com/2013/02/18/understanding-routes-in-the-yii-framework/
I know this does not solve your problem directly, but hope it gets you somewhere!
L.E: Here you have the bitly extension for Short URL's: http://www.yiiframework.com/extension/bitly-url-shortener/
Keep on coding,
Ares.
Why would that rule apply to your URL? From what I can see your URL will never trigger that rule.
I do not think there is a limit with the string of the URL in Yii2, try deleting some of the first part of the string to test this. try with an url like
http://website/proiectul-%E2%80%9Emodernizare-drumuri-comunale-dc----dc----si-dc---a-de-pe-raza-comunei-lunca-judetul-boto-ani%E2%80%9D-863506-switch.html
You might have problems because you have diacritics in the URL, try without them.

sitemap on a website only shows one link

I have a little issue concerning the sitemap of a website.
The website is : http://parmemarin.com.
If I go on http://www.xml-sitemaps.com/ and try to generate a sitemap for my website I end up with only one link in my sitemap which is _inc/conditions.php
There is no index.php or other of my links (index.php?page=...)
Can someone help me on this one ?
Thanks
Well, that could be a problem with xml-sitemaps.com, it could be a problem with your site, or it could be a combination of both. I don't know that service, so I can't tell how it really works and what it does.
Skimming through your markup, I noticed that you linked to some URLs without encoding the ampersand. & (if used for parameters) should be & if you link it in HTML.
I wonder: Why don't you build your sitemap yourself? You are the only one who knows for sure which pages exist on your site. Collect all your URLs and put them in a file, like http://www.sitemaps.org/ describes.
thanks, for your answer.
I had totally forgot to delete the meta : no index, no follow ... That clearly didn't helped :)

Passing the arguments to a website

Well the title is tricky. I was not sure if this has been already there and how to put it.
Example:
Lets suppose my site is accessible:
http://mysite.com
if mysite does additions: with 2 inputs
Now If the end user need to pass an argument to site like this (so i load the page like this):
http://mysite.com/argument1/argument2
so it should be able to thus go to the result directly: arg1+arg2
This brings to the question:when user types this, how can i retreive argument1 and argument2 and load my site according to that? Is it possible? If yes, Any client site programming solutions?
Thanks in advance.
Found the solution after searching a lot. The correct term for this process is URL-routing. We can overcome this by using #.
www.mysite.com/#/argu1/argu2
Then in the document.ready() we can read the url in the following manner:
var url = window.location;
More sophisticated way is to use the "backbone.js" for the routing. The documentation on the link explains everything
Backbone.js routing

Language name in prestashop URL

my prestashop base site URL is - www.7color.eu. Some urls are showing in this way -
http://7color.eu/lang-en/12-t-shirt.html
http://7color.eu/lang-en/5-gift-item
http://7color.eu/lang-en/content/4-about-us and so on
But it was not like this. "lang-en" part was not in it. i don't understand when and how did it happen. Now i cannot remove this part. i tried to edit htaccess or re-generate it from admin. but no luck. i want the urls like -
http://7color.eu/12-t-shirt.html
http://7color.eu/5-gift-item
http://7color.eu/content/4-about-us etc.How can I do this? i need urgent help please.
I think perhaps it has to do with enabling the nice URL strings.

Mod rewrite problem: rewrite url with drupal

Im am working on a drupal website with acqui solar search. I have to use this url /search/apachesolr_search/, but I want to change it to 'search' instead.
If u create an alias, my search doesn't work anymore...
Can someone help met to write a function for the 'Mod rewrite' module or give another option?
Thanks in advance
I found a way to do it, using the menu_hook and callbacks.
You can read more about it here.