Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Need Htaccess To Rewrite Subdirectory Up One Level


  • Please log in to reply
No replies to this topic

#1 TeamSDA

TeamSDA

    HR 1

  • Members
  • Pip
  • 2 posts

Posted 23 April 2013 - 07:12 PM

Hey Everyone,
 
We are having an issue with our htaccess file. Our goal is to get the pages in a subdirectory to be viewed in the URL as if it were up a level. For example:
 

Our files are located in :

/folder/subfolder/index.php

 

Naturally it would reflect on the web as:

http://www.domain.com/folder/subfolder/index.php

But we want it to rewrite as:

http://www.domain.com/subfolder/index.php
  • Keep in mind if someone were to manually:
    http://www.domain.com/folder/subfolder/index.php
  • We would need the htaccess to force write: 
    http://www.domain.com/subfolder/index.php
Currently we have the following in our htaccess:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^GET\ /([^.\ ]+\.)+php(\?[^\ ]*)?\ HTTP
RewriteRule ^(.+)\.php$ <http://www.domain.com/subfolder/$1> [R=301,L]

 

 
For the most part our htaccess is doing it’s job. The only issue we are having is that it is stripping the php extensions off of all our pages. We need the extensions to remain there for technical reasons.
 
As of right now, when we manually enter:
http://www.domain.com/folder/subfolder/index.php
 
The htaccess forces it to be re-written to:
http://www.domain.com/subfolder/index
 
How do we stop it from excluding our extensions? Just to clarify, it is functioning perfectly for what we want except for the fact that it is excluding our page extensions. Are we going about this correctly or is there a better way of accomplishing this. Any kind of help would be greatly appreciated.
 
Thanks,
Bernard





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!