2

i have build a webapp on Cakephp 2.3 .. on my locaLhost all urls were fine.. i can access my urls like this

http://localhost/Cakephp

but now when i have uploaded the site on server in root folder ... i cant access my url like this

http://www.myweb.com

instead it can accessible like this

http://www.myweb.com/index.php/login

what i think that might be a problem is the .htaccess file in my app/webroot folder

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

I think this kind of index.php is causing the problem ..as i dont know about .htaccess so dont know how to remove it.

How do I get index.php out of my urls?

1
  • What you describe means that mod_rewrite isn't enabled - which also probably means that your host has disabled .htaccess files. You can't solve this without modifying your apache config, which on a shared host (are you on a shared host?) will almost certainly not be possible. Commented Jul 8, 2013 at 7:52

3 Answers 3

3

So, it should be ok? You already have mod_rewrite?

If mod_rewrite is correctly loaded, .htaccess files are in place and index.php still appears in links then it is most probably problem with core.php framework configuration file.

Problem cause

In my case it was problem with App.baseUrl configuration option:

Configure::write('App.baseUrl', env('SCRIPT_NAME'));

Solving problem

Here is how I fixed that problem (and few others with redirects) by commenting out following line from core.php:

// Configure::write('App.baseUrl', env('SCRIPT_NAME'));
Sign up to request clarification or add additional context in comments.

Comments

2

Check the mod_rewrite module is installed or not? if not kindly enable it in httpd.conf file.

Find the following line and remove # (means uncomment) in front of it.

 LoadModule rewrite_module modules/mod_rewrite.so

Also don't forget to restart apache http service using following command:

 service httpd restart

Following are the steps to edit http.conf file from CPanel:

  1. Log in to WHM/cPanel as the root user.
  2. Open the "Service Configuration" section.
  3. Open the "Apache Configuration" section.
  4. Click "Global Configuration" to access the httpd.conf's settings, as displayed through cPanel.
  5. Make your desired changes, then click the "Save" button. This saves the changes and then reboots Apache so that the changes are applied.

Read more: http://www.ehow.com/how_8696084_edit-httpdconf-cpanel.html#ixzz2YRDEgOMT

On IIS Server Read this link to enable mod_rewrite

6 Comments

HOw to i enable it ? where do i find the mod_rewrite option ?
how can i access the httpd.conf file? where it would be ?
You will find httpd.conf file at /usr/local/apache/conf directory. Check this link: ehow.com/how_8696084_edit-httpdconf-cpanel.html
i have uploaded my site to Windows server running IIS
You should look into this link: iis.net/learn/extensions/url-rewrite-module/…
|
0

on ubuntu,

sudo a2enmod rewrite
sudo systemctl restart apache2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.