1

i've read a lot of setup subdomains on codeigniter, but nothing matched may situation.

I want to route by calling a subfolder or subdomain inside the public folder, so i dont need to use a controller from codeigniter.

Example

alls these domains should route to http://www.example.com/uploads/.../test

(Routing without refreshing the Url)

Whats the best/easiest way to do that?

So i trie to do this with the folloing htaccedd code

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain\.com/subdomains/%1

What i have to change, that the url wont refresh, i mean, i want to see the old subdomain url not the new with ".../subdomain"?

RainerS
  • 423
  • 1
  • 4
  • 11
  • what do you mean by routing without URL? once you setup a subdomain, as soon as you access the folder/project app url, it will automatically work fine since the base url would be the actual sudomain url – Danyal Sandeelo Jan 07 '19 at 07:22
  • not without url, i wrote without refreshing the url - i mean, after all, the adress in the browser should not show ...uploads/..../test – RainerS Jan 07 '19 at 07:24

1 Answers1

1

add an htaccess ... at every path and request uri using it at the last ... load ... index.php

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !from/your/hosting/basepath.php/
RewriteRule (.*) /from/your/hosting/basepath.php/$1 [L]
Masih Ansari
  • 467
  • 3
  • 9
  • i trie it, ive edit my posting, could you tell me what i have to change that the urladress wont update on rewrite? – RainerS Jan 07 '19 at 10:52