Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-stand alone issues with .htaccess file #161

Open
naip1984 opened this issue Jul 17, 2013 · 5 comments
Open

Non-stand alone issues with .htaccess file #161

naip1984 opened this issue Jul 17, 2013 · 5 comments

Comments

@naip1984
Copy link

I think putting more information up about the .htaccess file might be useful for people.

It took me a good bit of time to figure out what was going on between apache and the dispatcher.

RewriteEngine On RewriteCond %{REQUEST_URI} !dispatch.php$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .\* dispatch.php [L,QSA]
@peej
Copy link
Owner

peej commented Jul 17, 2013

I agree, what would you suggest?

@rovangju
Copy link

There's a lot of variations, things get messy when you consider forcing trailing slashes (/foo vs /foo/) for pragmatism. There should be a disclaimer about these complexities along with a very basic 'get er working' suggestion:

RewriteEngine On

#Un-comment and edit if placed in anything but the DocumentRoot
#RewriteBase /path/in/DocumentRoot

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} ""

RewriteRule ^(.*)$ dispatcher.php [L]

@tagadvance
Copy link

In regard to forcing trailing slashes, I have developed the habit of ending each @uri with /?, e.g.

/**
 * @uri /customer/:customerId/?
 */

While this may not be the best practice, it was the simplest solution I could come up with. It should also provide more flexibility across varying development environments.

@drkibitz
Copy link
Contributor

Personally, I don't really like forcing slashes in the web server. I would be +1 for this being an optional commented out piece. I also +1 @rovangju your RewriteBase comment.

Also here's a pretty weird variation I had not seen before, https://github.com/zendframework/ZendSkeletonApplication/blob/master/public/.htaccess. I'd like to note that I actually tried this in one of my sites running through CGI with tonic, and it didn't work.

@naip1984
Copy link
Author

I think my suggestion is coming from my newness to tonic. I hadn't used the php -S stand alone option before. Thats really nice, and got me working with tonic right away. But, later, when I went to figure out what was needed to deploy the simple service I'm testing, I had a hard time trying to get everything working correctly with apache. In digging I found the .htaccess file. By playing around, I figured out, it was what I needed to focus on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants