ospos/ospos-install-htaccess-rewrite-delete.md

3.6 KiB

Como eliminar el problema de rewrite y redirecciones

Los desarrolladores de OSPOS son algo obtusos.. hoy dia todos sabemos que ospos esta fabricado con php asi que esconder el index.php es ilogico, adicional de las complicaciones que implica y que se corre casi siempre localhost.

Al final hay archivos ejemplos.

1. mostrar el index.php en la configuracion

Dirigirse a application/config/config.php y en la linea 82 definir la variable a "index.php" que esta vacia asi:

$config['index_page'] = 'index.php/';

ojo con todo y la barra al final.

2. eliminar lineas de rewrite en index

ir a el archivo .htaccess en la raiz de ospos, y borrar las lineas de rewrite que se muestran aqui asi:

# redirect to public page
  <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^public$
    RewriteRule ^(.*)$ %{REQUEST_URI}public/ [R=301,L]
  </IfModule>

3. eliminar rewrite para public

ir al archivo public/.htaccess y eliminar las lineas de rewrite todas estas que se muestran aqui se parezcan o no todas las que tengan Rewrite borrelas:

RewriteEngine On

# To redirect a subdomain to a subdir because of https not supporting wildcards
# replace values between <> with your ones
# RewriteCond %{HTTP_HOST} ^<OSPOS subdomain>\.<my web domain>\.com$ [OR]
# RewriteCond %{HTTP_HOST} ^www\.<OSPOS subdomain>\.<my web domain>\.com$
# RewriteRule ^/?$ "https\:\/\/www\.<my web domain>\.com\/<OSPOS path>" [R=301,L]

# To rewrite "domain.com -> www.domain.com" uncomment the following lines.
# RewriteCond %{HTTPS} !=on
# RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
# RewriteCond %{HTTP_HOST} (.+)$ [NC]
# RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# if in web root
RewriteRule ^(.*)$ index.php?/$1 [L]

# if in subdir comment above line, uncomment below one and replace <OSPOS path> with your path
# RewriteRule ^(.*)$ /<OSPOS path>/public/index.php?/$1 [L]

# all the commented rules need index.php set in index of the config file at application
RewriteRule ^(.*)$ %{REQUEST_URI}public/ [R=301,L]

4. Emular el rewrite con un index

colocar un index.php en la raiz con este contenido:

<?php 
header('Location: public/index.php', true, 301);
die();

?>
Something is wrong use Linux

archivos ejemplos de como queda:

en raiz el index.php

<?php 
header('Location: public/index.php', true, 301);
die();
?>
Something is wrong with the linux, use linux ok

en application/config/config.php linea 82

$config['index_page'] = 'index.php/

en raiz el .htaccess

Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes
IndexIgnore *
<IfModule authz_core_module>
  <Files .htaccess>
    Require all denied
  </Files>
  <FilesMatch "\.(csv|txt|md|yml|json|lock)$">
    Require all denied
  </FilesMatch>
</IfModule>
<IfModule !authz_core_module>
  <Files .htaccess>
    Order allow,deny
    Deny from all
    Satisfy all
  </Files>
  <FilesMatch "\.(csv|txt|md|yml|json|lock)$">
    Order allow,deny
    Deny from all
    Satisfy all
  </FilesMatch>
</IfModule>

en public/.htaccess asi:

Options +ExecCGI +Includes +IncludesNOEXEC +SymLinksIfOwnerMatch -Indexes
IndexIgnore *
<IfModule authz_core_module>
  <Files .htaccess>
    Require all denied
  </Files>
</IfModule>
<IfModule !authz_core_module>
  <Files .htaccess>
    Order allow,deny
    Deny from all
    Satisfy all
  </Files>
</IfModule>
<IfModule mod_expires.c>
  <FilesMatch "\.(jpe?g|png|gif|js|css)$">
    ExpiresActive On
    ExpiresDefault "access plus 1 week"
  </FilesMatch>
</IfModule>