Announcement Announcement Module
Collapse
No announcement yet.
Apache Configuration Help Page Title Module
Move Remove Collapse
Search Search Module
Collapse

Advertisement Advertisement Module
Collapse

Featured Images Featured Images Module
Collapse

Mediabistro Creative Sites Mediabistro Creative Sites Module
Collapse
Latest Topics Latest Topics Module
Collapse

  • kemingMatters
    Comment on Self Logo Critique
    kemingMatters
    I'm fully aware that the first logo is black and white, I was commenting on how difficult it is to read at any distance other than on top of it.

    The only versions that are really that legible...
    Today, 07:08 PM
  • garricks
    Comment on Indesign CC Exporting
    garricks
    Yeah, i have to agree…
    Today, 06:34 PM
  • subdrewgans
    Reply to Self Logo Critique
    subdrewgans
    In the first link, the very first logo is B&W. I think the one with your initials are stronger, but definitely needs some work and tightening up.

    What does your logo say about you?...
    Today, 06:18 PM
  • CataclysmX
    Comment on Steampunk Tea Brand Logo Critique- Trying to choose final concept
    CataclysmX
    Yeah I meant use the same typeface from the S in the green logo, but if that doesnt work I would keep exploring, fonts are really underrated and people need to spend time finding working fonts to improve...
    Today, 05:55 PM
  • kemingMatters
    Reply to Indesign CC Exporting
    kemingMatters
    Hello LaraMelissa1, welcome to GDF!
    We ask all new members to read very important links here and here. These explain the rules, how the forum runs and a few inside jokes. No, you haven't done anything...
    Today, 05:30 PM
Advertisement Advertisement Module
Collapse

Sponsors Sponsors Module
Collapse

X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Apache Configuration Help

    This is a shot in the dark, but sure some of you have dealt with this same problem.

    Would it be possible to create a rewrite rule that would remove index.php from the typical /index.php/controller PHP MVC app route?

    What I have: /index.php/blogs/1/20/

    What I would like: /blogs/1/20/

    So I would ideally like all my paths to look like:

    www.whatever.com/blogs/1/20/
    www.whatever.com/user/3/
    www.whatever.com/blog-entry/1/3/10/

    I think you get the idea.

    The application is responsible for breaking up all the paths so all I need is a way to route everything without using site.com/index.php/x/y/z/ , but rather site.com/x/y/z/.

    any help appreciated as I'm not very familiar with apache configuration.

  • #2
    Possible? Yes, but probably not a good idea. Or, at least, a very complicated to pull off one.

    Apache's mod rewrite rules are regular expressions. So you'll need to produce a regular expression - or set of regular expressions - that will rewrite the URL to go to the right page (which is easy) but not rewrite the URLs for your images/CSS/Javascript/anything else that isn't a PHP page (not so easy). Including the index.php in the URL makes it easier to identify the URLs for rewriting in your regex. But, as long as there's some systematic way to identify the URLs to rewrite, it can be done.

    Comment


    • #3
      tZ look up .htaccess SEFs and .htacess rewrite and if you are using a blog application put that in there too.

      .htaccess is a public text file that overwrites the apache config file without actually doing anything to apache core. Great method so that you won't have to worry about what you did when upgrading.

      The htaccess rewrite command will get you where you need to be. This is from a quick google that looks ok.

      http://www.yourhtmlsource.com/sitema...rewriting.html

      Jade

      Comment


      • #4
        Here's the core link.
        http://httpd.apache.org/docs/trunk/howto/htaccess.html

        http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html
        Last edited by Drazan; 06-16-2009, 10:32 PM.

        Comment


        • #5
          I'm not positive, but I'm thinking something along these lines would work. The only directories at the root of the site are include,vendor and img. So if the beginning doesn't matches any of those rewrite perhaps?

          Code:
          <IfModule mod_rewrite.c>
          
          RewriteEngine on
          
          RewriteRule ^.*?(?<!index\.php|include|img|vendor)/(.*?)$ /index.php/$2 [L]
          
          </IfModule>
          Last edited by tZ; 06-16-2009, 11:12 PM.

          Comment


          • #6
            Originally posted by tZ View Post
            I'm not positive, but I'm thinking something along these lines would work. The only directories at the root of the site are include,vendor and img. So if the beginning doesn't matches any of those rewrite perhaps?

            Code:
            <IfModule mod_rewrite.c>
            
            RewriteEngine on
            
            RewriteRule ^.*?(?<!index\.php|include|img/vendor)/(.*?)$ /index.php/$2 [L]
            
            </IfModule>
            Sounds right to me.

            Comment


            • #7
              oh it has been a while ... you are making my brain work tonight.

              Try this if that doesn't work as expected.
              This should remove the index.php from the url entirely. Place the .htaccess file in the same directory as the index.php

              If it drops your site, then remove the .htaccess file.

              And to test that you can actually see the .htaccess file with your ftp. put a blank file in there first.
              Code:
              <IfModule mod_rewrite.c>
              
              RewriteEngine on
              
              RewriteRule ^/([a-zA-Z0-9_-]+)/([0-9]+)/$ index.php/$2/  [R]
              RewriteRule ^/([a-zA-Z0-9_-]+)/([0-9]+)/$ index.php/$2  [QSA,L]
              
              </IfModule>

              Comment


              • #8
                That results in a apache request error (mine not drazan's - at least yet).

                Comment


                • #9
                  no go drazan.

                  404 - not found

                  I haven't used apache to rewrite anything in a couple months so I'm a little rusty myself.

                  The site isn't a blog, but has a blog module so to speak. Those URLs were just examples though.

                  I just need everything to go to the index page unless the beginning of the string is img, vendor, include or index.php.
                  Last edited by tZ; 06-16-2009, 11:43 PM.

                  Comment


                  • #10
                    i'm a novice to regular expressions, having just learned how to write one a couple days ago...but i understood that you had the carrot (^) then two forward slashes, and what you wanted to include between the slashes...

                    so, shouldn't there be an ending slash on that second one?...if not, how come?
                    Monarchs Rule!

                    Comment


                    • #11
                      I had add a line to application code to look for the pathway var, but this is working. I much rather reset path_info after the rewrite, but that doesn't seem possible.

                      Code:
                      <IfModule mod_rewrite.c>
                      
                      RewriteEngine on
                      RewriteCond &#37;{REQUEST_URI} !^/(index\.php|include|vendor|img)
                      RewriteRule .? /index.php?pathway=%{REQUEST_URI} [L]
                      
                      </IfModule>
                      Last edited by tZ; 06-17-2009, 03:53 AM.

                      Comment

                       
                      home | site map | advertising/sponsorships | about us | careers | contact us | help courses | browse jobs | freelancers | events | forums | content | member benefits | reprints & permissions about | terms of use | privacy policy | Copyright © 2014 Mediabistro Inc. Mediabistro Inc. call (212) 389-2000 or email us
                      Working...
                      X