www.webdeveloper.com
Results 1 to 5 of 5

Thread: htaccess mod_rewrite issue

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    18

    htaccess mod_rewrite issue

    I have a client that has an htaccess file that rewrites his url from mydomain/somepage.php to mydomain/somepage. It's working fine in his root folder. I need to re-design his site so I'm trying to build it in a new folder. I copied the htaccess file into the new folder, but it doesn't seem to recognize the re-written URLs. Here is the content of the htaccess file:
    RewriteEngine On

    RewriteRule ^equipment/(.*)$ equipment_category.php?id=$1
    RewriteRule ^browse/(.*)$ equipment_category.php?keyword=$1
    RewriteRule ^product/(.*)$ equipment_product.php?code=$1
    RewriteRule ^product/s/(.*)$ equipment_product.php?op=s&code=$1

    Since this file is in the new folder, I would imagine that I shouldn't have to enter the new folder name since this should see the new folder as a root, correct? Any suggestions? (This content is the same content as the htaccess file in the root folder.)

  2. #2
    Join Date
    Sep 2013
    Posts
    221
    Try with the below code:

    RewriteRule ^/location/(.*)$ /location/usa/$1 [R]

    you can refer to the link below:
    http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

    Hope this helps.
    strad solutionswww.stradsolutions.com

  3. #3
    Join Date
    Sep 2006
    Posts
    18
    Sorry, it didn't work - unless I put the code in the wrong htaccess file? I put it in the one in the new folder - not the root folder. I would prefer to not touch the root htaccess file, if possible, since it's working just fine for their current site. This folder is just temporary while I build them a new site. The URL's come out as domain/newfolder/equipment/category - which is what we want, but I just get a white screen, the page doesn't load.

  4. #4
    Join Date
    May 2007
    Posts
    184
    Try adding the path to the new folder in rewrite destination.

    /mynewfolder/equipment_category.php?id=$1
    "Profanity is the one language all programmers know best."

  5. #5
    Join Date
    Sep 2006
    Posts
    18
    Sorry, that didn't work either - I didn't think it would since the htaccess file is already IN the newfolder - so the path would not include a subdirectory. But thank you for taking the time to review and offering a suggestion. I have tried putting the /newfolder/ on both sides of the mod-rewrite as well with no success. I currently have the new site setup using the ugly URL's by duplicating the php includes and putting them in the new folder with the new site, I can reference them and we can review the site. When I move the pages to the root folder, they will include the current php include navigation files and the URLs should stay as they are now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles