简体   繁体   中英

.htaccess subdomain to subdirectory without changing URL in joomla

I have VPS and i want to implement sub-domain. i created one sub-domain for one url, how could i link up there.

EXAMPLE

SUB DOMAIN IS - abc.mysite.com

AND LINK URL IS - mysite.com?index.php&option=com_test&view=test&id=1

i want to link url to sub domain without change address bar.

In address bar show "abc.mysite.com" but actual run this "mysite.com?index.php&option=com_test&view=test&id=1"

what is the rule of .htaccess? or other this is better and which?

.htaccess allows you to specify how your server should respond to a given request. It does not have the ability to tell the users browser to show a different address.

http is a stateless protocol , which means that each request should have all the information you need to respond. If the user's address bar shows "abc.mysite.com", then that is what their browser will request from your server. Given that request, your .htaccess has no way to know that they want a certain id or view.

If they had the address abc.mysite.com/com_test/test/1 in the address bar, then you can use that because it has all the information you need to complete the request. You can create a .htaccess rule to route that to "mysite.com?index.php&option=com_test&view=test&id=1". But you can't do that with just the base url - the information just isn't there.

What you can do is use an ajax request to get the information without a page reload, and therefore without changing the url shown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM