I have an instance of cakePHP installad on my local machine.
I use WAMP to run PHP and updated my httpd.conf with these :
Listen 8080
ServerName localhost:8080
I need it on port 8080 so it won't interfere with other apps I use.
The proble is that when I type localhost:8080/application in my browser, it redirect to localhost/application and shows a blank screen.
Here are the 2 .htaccess files that might be relevent.
1- In application root folder :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
2 - In application/app
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /application/app/webroot
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(app/webroot/)?(img|css|js)/(.*)$
RewriteRule ^(.*)$ index.php [QSA,L]
ErrorDocument 404 /404-not-found
I've made some research and can't find anything specific to my situation.
Does any of you know what is happening and how I could fix this ?
Finally, the problem was not with the port redirections. The root .htaccess file had no RedirectBase specified. I changed the first .htaccess (application root) for this :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /application/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
and all works fine now.
The fact that it was redirecting from localhost:8080/application to localhost/application was not the cause of the problem but merely a symptom. I guess the browser just strips the port from the URL when it receives a "Cannot connect" error.