subdomain url using .htaccss - .htaccess

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.

Related

Using htaccess to redirect URL from one query string to another

I need to redirect
from
/showthread.php?tid=6
to
/viewtopic.php?t=6
using htaccess. We moved from MyBB to PhpBB and would like to safe links leading to our site.
The domain remains the same. All my attempts failed.
Can someone help?
^showthread.php?tid=(\d+)$ viewtopic.php?t=$1
This should do the trick with htaccess redirect parameter :)

IIS rewrite subfolder URL to subdomain content

I'm trying to load content hosted on a subdomain site as a subfolder on the same main domain - I've attempted a variety of IIS URL rewrites with no luck so far. The goal is for a user to go to:
domain.com/subdomain1
which displays
subdomain1.domain.com
but keeps the URL as
domain.com/subdomain1
There are multiple subdomains which I need to do this with.
I have the URL Rewrite module installed and have tried all many of rules.
Any help would be appreciated :-)
A rewrite changes the path on the server only, if you want the URL to change you need a redirect. You can change this on the rule.

htaccess redirect with parameters not working correctly

hope you can help me. i need a redirect from
/abc_company_detail.php?id=4 to detail/4/
So when I call the URL http://mydomain.com/abc_company_detail.php?id=4 then I got this pretty URL http://mydomain.com/detail/4/
You can use some PHP framework, and it will managed the URL for you. If you want to do it manually you have to configure .htacess file.
Try this link. .htaccess friendly URl
This kind of question had been asked before.

How can I redirect and then rewrite url in same file for pretty URL?

I have just been asked to migrate a site from one server to another for a site that I did not build. They have a lot of links to pages that dont exist.
<a href="app/batteries">
This is not actually a directory in the site, but there is an app.php file in the root directory. I have gotten it to display the products by redirecting anything to the app/ directory to app.php?app=. The value of ?app= is dynamic, so any solution would need to be dynamic. I have simply used the redirect statement in the htaccess file to get it to the app.php page. Is there a way to get the url back to the pretty url after a redirect?
Any help would be awesome. Thanks in advance.
You should use ModRewrite instead, for matching a pretty url with regexps, and converting into the url using the app.php.
The rewrite is local to the server, so the visitor sees only pretty urls.

how to make clean url using htaccess for subdomain

for e.g. my domain is www.examples.com and subdomain is test2.examples.com
I am using url variable to link pages.
e.g.test2.examples.com/index.php?page=registers
but I want clean url like
test2.examples.com/page/registers
How can I do this using HTACCESS file.
can I use HTACCESS for subdomain or it will not allow
You are looking for URL Rewriting, it will answer all your needs., see this URL Rewriting Guide

Resources