Dynamic Subdomain Using Url Rewriting in yii - .htaccess

I want to create dynamic sub domain .I want to do with help of yii framework.
By giving url will generate virtual sub domain.
I have below url.
http://www.xyz.com/dq/logic/pd[controller]/dispall [method]/web [parameter 1]/web-designer [parameter 2]
From this url to I want to convert below url
http://web[ parameter 1].xyz.com/dq/logic/pd[method]/dispall[method]/web-designer [parameter 2].
Any one can help me about this ?

Related

Not able to access wildcard subdomain in Django app on online server

I am hosting a Django app on managed server with passenger_wsgi file. Let assume app main url is 'www.mysite.com'. When i visit this it shows me the homepage. What i want is to use wildcard subdomains in the app.
Like www.user1.mysite.com , www.user2.mysite.com , www.user3.mysite.com and so on, it can be any wildcard.
I have created a wildcard subdomain from cpanel like "*.mysite.com" , also added wildcard in my django settings.py file too. But when i visit the "www.user1.mysite.com" browser says
Not Found The requested URL was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
settings.py
DEBUG = False
ALLOWED_HOSTS = ['.mysite.com','mysite.com']
Any kind of help would be great.
Thanks..!!

Netlify pretty query

I want to host a Netlify website where you can search for specific users. Currently its like this https://example.com/users?q=exampleuser . (its https://example.com/users.html but pretty url'ed)
But what I want is to make the URL query pretty. So the endresult should be https://example.com/users/exampleuser but it should still be a url query so the JavaScript can make calls based on the query.
e.g.:
https://example.com/users?q=test123 to
https://example.com/users/test123
https://example.com/users?q=example456 to
https://example.com/users/example456
The rewrite rule will work with:
/users q=:q /users/:q 200
When you navigate to https://example.com/users?q=exampleuser, you must have an existing endpoint at https://example.com/users/exampleuser/ or it will give a 404 status code, but will still rewrite the original path.
Note: If you have an existing endpoint at /users/ this method will not fallback if the rewrite path has an invalid endpoint. Meaning you can't fallback to /users/ endpoint if the query path is an invalid endpoint.

Prestashop module page url rewrite in htaccess

i have created a controller in prestashop module. my url is like this http://www.prestashop.com/module/homepageadvertise/brands/
i want my url should be like this
http://www.prestashop.com/brands/
How can i achieve it by changing the htaccess?
yau can change in BO > prefences > SEO & URL > just add new , in page you chose module, in Rewritten URL type brands
and save

How would i create a custom dynamic url in codeigniter

I hate the codeigniter custom urls where it's: domain.com/controller/action/username
How can I have it like a normal website like: domain.com/username
Please give me a suggestion.
You try this in routes.php
$route['(:any)'] = "controller/action/$1";
Here is the routing documentation : routing
Please refer http://ellislab.com/codeigniter/user-guide/general/routing.html. You can do this by URL routing

Multiple urls point to same application with query strings

I have 2 domain name, let's say www.contoso.com and www.contoso.de , and in my IIS, i have 1 web app and it should take this request as
www.contoso.com -> www.internal.com?l=en
www.contoso.de -> www.internal.com?l=de
What's the best practice for this and rewrite all html anchors ( a href ) as appropriate ?

Resources