0

I am developing this app using Zend Framework 1.12. I wan to get rid off the index.php using .htaccess. Right now my url looks like this:

http://foo.com:10080/Reports_Century/public/index.php/reports/neworders

I want to be able to look like this

http://foo.com:10080/Reports_Century/public/reports/neworders

Is it possible? my htaccess looks has the following lines:

RewriteEngine On
RewriteCond% {REQUEST_FILENAME}-s [OR]
RewriteCond% {REQUEST_FILENAME}-l [OR]
RewriteCond% {REQUEST_FILENAME}-d
RewriteRule ^ .* $ - [NC, L]
RewriteRule ^ .* $ index.php [NC, L]

thank you.

3
  • What is location of above .htaccess file? Commented Dec 4, 2013 at 17:09
  • it id inside the public folder Commented Dec 4, 2013 at 17:39
  • Thanks for your response, posted an answer below. Commented Dec 4, 2013 at 18:13

5 Answers 5

1

Have your public/.htacess like this:

RewriteEngine On
RewriteBase /Reports_Century/public/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.+)$ index.php/$1 [L]
Sign up to request clarification or add additional context in comments.

15 Comments

didn't work. I am still getting 404. Shouldn't i been getting a 500 error code instead of 404. How do i know for sure mod_rewrite is enabled.
Which URL did you use to test this rule?
Should it not be: http://foo.com:10080/Reports_Century/public/reports/neworders You are missing /public/ in your URL
even with the public it does not work.How can i check for sure if my rewrite is enabled?
mod_rewrite is enabled otherwise you will get 500 error. Do you have any other rule in your .htaccess OR is there any other .htaccess in the system?
|
0

Try adding this right below RewriteEngine On

RewriteRule ^index\.php/(.+)$ /public/$1 [L,R]

1 Comment

it didn't work Jon. Any thoughts? I am getting a 404
0

Version without index.php is default in Zend. You don't have to change default .htaccess. I bet you didn't enabled rewrite module in apache* or disabled rewriting in config.

* copy rewrite.load file to mods-enabled folder in apache (on ubuntu it's in /etc/apache)

Comments

0

finally found where the issue was. The problem was the $1 after index.php/.

the final .htaccess is:

RewriteEngine On
RewriteBase /Reports_Century/public/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.+)$ index.php [L]

@Anubhava giving you a plus one for speding the time and helping me with the solution.

Comments

0

You also need to activate "AllowOverride All" for your directory in apache2/sites-enabled/default:

    <Directory /var/www/html/public>
            AllowOverride All
    </Directory>

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.