how to make clean url using htaccess for subdomain - .htaccess

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

Related

.httaccess 301 redirect subdomain with path wildcards

I need to 301 redirect URL's I was using on my old website/platform to my new website on Shopify.
Old url structure:
https://shop.olddomain.com/path/name-of-page
What I would like to have is a wildcard for http/https, because the platform changed my website from insecure to secure back when Google started ranking based on that.
I would also need a wildcard for /path/name-of-page, because I have hundreds of URL's with that structure and I'm not trying to map each of those URL's to the new URL's. Basically, my goal is to make sure those old URL's don't go to a dead end 404, and are redirected to the new website homepage.
So http/https://shop.olddomain.com/* should redirect to https://newdomain.com
In your .htaccess for shop.olddomain.com place
Redirect 301 /shopoldpath https://newdomain.com

Need help redirecting one website URL to another with apache2 and .htaccess

I have two domains - https://hosting.opensimcity.org, and http://paradigm.pocketmud.com and I want to redirect the latter to the former. That is, when someone connects to http://paradigm.pocketmud.com I want it to redirect to https://hosting.opensimcity.org/paradigm
Any tips on doing this in my .htaccess file?
Just try the following htaccess redirect code:
Redirect 301 / https://hosting.opensimcity.org/paradigm
This 301 redirect response notifies the search engines that the page has moved permanently from the old URL to the new URL. The search engines also transfer the old URL page rank to the new URL.

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 URL of Subdirectories managed through CMS

All the urls of our site are written www.mydomain.com/sub1/cms/pagename
Through the CMS we can specify pagename
sub1 and cms are not actually directories on the server.
We need to change the pagenames to be more SEO friendly, but we still want any traffic to the old pagename to direct to the new one.
I have tried making an .htaccess file specifying:
Redirect 301 /sub1/cms/oldpagename mydomain.com/sub1/cms/newpagename
but it does not work.
I have been successful with:
Redirect 301 /oldpagename mydomain.com/sub1/cms/newpagename
Can this be done somehow through .htaccess?
First, make sure your 301 redirect rules for redirect use a full url including the http:// portion.
Redirect 301 /sub1/cms/oldpagename http://mydomain.com/sub1/cms/newpagename
Second, it sounds to me like your CMS has put a rewrite rule in place to handle the /sub1/cms/pagename style urls. If this rule comes before your redirect, your redirect will never get triggered. Try moving your redirect to the top of the .htaccess file.

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.

Resources