Problem polega na tym iż chciałbym móc obsłużyć rozpoznawanie nazw subdomen i wywowałanie skryptu przez htaccess na serwerze. Właściwy tag do binda już został dodany, więc adresy typu bleble.domain.com działają i odwołują się do danego konta na serwerze.

Celem jest jednak wywoływanie skryptu w stylu /index.php?/member/{subdomain} bez przekierowywania 301

Do tej pory mam coś takiego jednak otrzymuje wtedy komunikat:

  1. Not Found
  2. The requested URL /index.html was not found on this server.
  3.  
  4. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


  1. RewriteEngine On
  2. RewriteBase /
  3.  
  4. # sub domains
  5. RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
  6. RewriteRule (.+)$ /index.php?/ [L,P]
  7.  
  8. # codeigniter
  9. #Removes access to the system folder by users.
  10. #Additionally this will allow you to create a System.php controller,
  11. #previously this would not have been possible.
  12. #'system' can be replaced if you have renamed your system folder.
  13. RewriteCond %{REQUEST_URI} ^core.*
  14. RewriteRule ^(.*)$ /index.php?/$1 [L]
  15.  
  16. #When your application folder isn't in the system folder
  17. #This snippet prevents user access to the application folder
  18. #Submitted by: Fabdrol
  19. #Rename 'application' to your applications folder name.
  20. RewriteCond %{REQUEST_URI} ^application.*
  21. RewriteRule ^(.*)$ /index.php?/$1 [L]
  22.  
  23. #Checks to see if the user is attempting to access a valid file,
  24. #such as an image or css document, if this isn't true it sends the
  25. #request to index.php
  26. RewriteCond %{REQUEST_FILENAME} !-f
  27. RewriteCond %{REQUEST_FILENAME} !-d
  28. RewriteRule ^(.*)$ index.php?/$1 [L]


Całość stoi na serwerze debian z apache2 aplikacja php to nic innego jak codeigniter

Rozwiązanie:

  1. RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
  2. RewriteCond %{QUERY_STRING} !^/member/ # for stop looping
  3. RewriteRule ^(.*)$ /index.php?/member/%2/$1 [L]