SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    URL Rewriting Without mod_rewrite

    Hello,

    I'm trying to set up URL rewriting (which I've done many times before) using Apache mod_rewrite and it looks like .htaccess isn't supported on this set up.

    I've seen somewhere that you can set up rewriting using purely PHP, but I'm struggling to find any information on it. Can anyone point me in the right direction?

    Cheers,

    Jon

  2. #2
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,606
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Have you tried using this line in your .htaccess file before your rewrite statements?
    Code:
    RewriteEngine On
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I've been using the exact same script for rewriting URL's on brochure sites for well over a year, it's rather well tested...

    Thanks anyway,

    Jon

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2010
    Location
    Arizona
    Posts
    109
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thomas Hruska

    Single Sign-On Server/Client - The PHP login system that rocks.

  5. #5
    Non-Member
    Join Date
    Oct 2010
    Location
    Delhi
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    same scripting url can be classified.

  6. #6
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Web Hosting Reviews- BestWebHostingReview.org

    Cheers

  7. #7
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,036
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Dave McLovin View Post
    That also relies on a .htaccess file.
    As far as I know there is no way to create friendly URLs without using any form of .htaccess
    I think you'd better contact the hoster to ask if .htaccess files are indeed disabled, and if they are, if they could enable them.
    Are you server is Apache btw? If it's IIS you could use a httpd.conf with ISAPI Rewrite. Provided they have installed that of course.
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  8. #8
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've found out that it's a Windows machine without Apache, so it looks like there will be no rewriting

    Cheers,

    Jon

  9. #9
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,036
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    As I said above, if it's an IIS server you may still be able to rewrite if they have ISAPI Rewrite installed as a module for IIS
    If they don't, then there would indeed be no way to do rewrites ...
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  10. #10
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,301
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    all requests which aren't found go to a page not found page. put router-like code in that page's script. so basically in the not found page, using php, get the url and include() the right file. bingo. no .htaccess file access required what so ever.

  11. #11
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,036
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by johnyboy View Post
    all requests which aren't found go to a page not found page. put router-like code in that page's script. so basically in the not found page, using php, get the url and include() the right file. bingo. no .htaccess file access required what so ever.
    That assumes a PHP file can be used as the not found page. That is not necessarily the case, and if it isn't it won't work ...
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  12. #12
    SitePoint Enthusiast erangalp's Avatar
    Join Date
    Oct 2010
    Location
    Israel
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by johnyboy View Post
    all requests which aren't found go to a page not found page. put router-like code in that page's script. so basically in the not found page, using php, get the url and include() the right file. bingo. no .htaccess file access required what so ever.
    That technique is very bad for SEO since the server sends out 404 headers. Search engines assume the page does not exist

  13. #13
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jonpugh114 View Post
    I've found out that it's a Windows machine without Apache, so it looks like there will be no rewriting

    Cheers,

    Jon
    Jon, how much access to the machine do you have? If you want to have your own not found page etc, you can make custom ones.
    Ryan B | My Blog | Twitter

  14. #14
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,301
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by erangalp View Post
    That technique is very bad for SEO since the server sends out 404 headers. Search engines assume the page does not exist
    no, you only send out 404 headers if the page really isn't found. if it's an address to be considered valid, you just don't send out 404 headers from the page not found script.

  15. #15
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,301
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ScallioXTX View Post
    That assumes a PHP file can be used as the not found page. That is not necessarily the case, and if it isn't it won't work ...
    that's true. and i suppose if the 404 page has an html extension you'd need to either change the 404 page to be used to a php one, or make it so that html extensioned files are parsed by the php parser, either way, .htaccess required. maybe the OP could request the hosting company to change the not found page to a file path of his choice. if so then it'd be possible.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •