CodeIgniter Forums
Shorted URL don't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Shorted URL don't work (/showthread.php?tid=77324)



Shorted URL don't work - alfonsosach - 08-17-2020

Good morning
I use CodeIgniter 4 for a work proyect. In my computer works correctly, but in the server the shorted urls don't work. I and the server admind tray but we don't find any solution. In the same server have a CI 3 proyect for 1 year and works correctly.

This is the Apache config:

Code:
<VirtualHost *:80>
  ServerAdmin [email protected]
  ServerName  www.miweb.es
  ServerAlias miweb.es
  DocumentRoot /miweb/public
  ErrorLog ${APACHE_LOG_DIR}/miweb_error.log
  CustomLog ${APACHE_LOG_DIR}/miweb_access.log combined
  <Directory "/miweb/public">
    Options +Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>

And app/Config/App:
Code:
public $baseURL = 'http://miweb.es/';
public $indexPage = '';
public $uriProtocol = 'REQUEST_URI';



RE: Shorted URL don't work - InsiteFX - 08-17-2020

In your ,htaccess file where index.php is add this:

Code:
# apache .htaccess file remove www
<IfModule mod_rewrite.c>
    
    RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
    RewriteRule (.*) https://example.com/$1 [R=301,L]
    
</IfModule>