How can we use our folder as a subdomain using htaccess? - .htaccess

Hi are there ways to make the subfolder type like these in a url.http://subfolder.domain.com
http://domain.com/subfolder
http://subfolder.domain.com

Unfortunately it isn't possible with .htaccess alone, you need to fiddle with your web server's config.

Related

How to get Dynamic URL with the help of Web.Config and PHP

Suppose i have
3 php pages
www.example.com/page1.php?var1=data1&var2=data2&var3=data3
www.example.com/page2.php?var1=data1&var2=data2&var3=data3
www.example.com/page3.php?var1=data1&var2=data2&var3=data3
For good SEO . I need URL like
www.example.com/page1/data1-data2-data3
www.example.com/page2/data1-data2-data3
www.example.com/page3/data1-data2-data3
i need all the variables for proper functioning of php pages. Some suggests me to use htaccess file but my website is on godaddy windows hosting so htaccess doesn't work ..
.
Go Daddy allows you to use URL rewrite module if you are on windows hosting plan. You can achieve the desired effect with URL routing.
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module should give you all the information you need for setting up the appropriate rewrite rule.

Symfony2/ get variable from subdomaine and htaccess

I using Symfony2.
What would be the best practice to get a variable from URL. I am using subdomain to get the city.
Ex: paris.website.com
how do I get Paris as variable.
I believe I need to play with Kernel and htaccess, but I haven't figured out how.
Thanks if you can put me on right tracks about that.
Cheers,
Pierre.
You should read the documentation of Symfony. One of the basis components of Symfony is the Routing that provides exactly what you need :
www.mysite.com/paris/
Using the subdomain is not the solution, but you can play with .htaccess to rewrite subdomain paris.mysite.com to www.mysite.com/paris (if web server allows it) after having configured your route in Symfony.

How to add something to start of url using htaccess?

I have seen sites that when you login it will look something like...
.example.localhost/blahblah.php
how is this possible with htaccess?
Any ideas
Do the files have to be placed in a seperate folder??
It's called sub-domain.
It has more to do with the DNS but htaccess can be used to modified its behavior.
Ie, point different sub-domain to the same folder.

subdomain url using .htaccss

This is my website url http://mywebsite.com
I create an another website but this website's url would be http://mywebsite/mynewwebsite.com
Please help to find the solution using .htaccess file.
That's impossible. You can do http://mywebsite.com/mynewwebsite/ or http://mynewwebsite.mywebsite.com/ but not what you're asking.
Furthermore, I don't think you can set up subdomains simply using htaccess.

.htaccess solution for localhost

I am developing local websites and keep having problems with wordpress sites when they use relative links such as:
<a href="/wp-content/themes/mytheme/myfile.php">
This resolves to my localhost document root (htdocs) instead of the root of the job (htdocs/myjob).
Is it possible to use an .htaccess file in the root of the job (htdocs/myjob) folder to "fix" this behaviour? Or is it possible to put this htaccess file in htdocs, check the HTTP_REFERER, and send the browser to the correct site root?
Can you show me an example of the rewrite rule needed?
Any other suggestions would be welcome too.
In fact you mean absolute links. Relative links are what you want.
You should be able to configure the root directory in your Wordpress setup: this would be the correct approach.

Resources