Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 11th February 2011, 17:30
gring gring is offline
Member
 
Join Date: Mar 2009
Posts: 46
Thanks: 2
Thanked 3 Times in 3 Posts
Default [solved] htaccess rewrite directory patterns

Hi, sorry if I post in the wrong forum, this is both about website dev and apache configuration.

How can I redirect, using a .htaccess file, a "fake" directory url, like

http://www.example.com/hard_director.../var2/var3.php
to /hard_directory/script.php?var1=$var1&var2=$var2&var3=$var3

my .htaccess file, placed in /hard_directory/ contains:

Code:
Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]*)/([^/]*)\.php$ script.php?id_urlrw1=$1&id_urlrw=$2 [L]
It doesn't produce a 404, just a blank page, and script.php is not called.
I also tried to escape the slash, to remove the RewriteConds, and replace [^/] with .*

Help

Last edited by gring; 12th February 2011 at 20:15.
Reply With Quote
Sponsored Links
  #2  
Old 12th February 2011, 20:14
gring gring is offline
Member
 
Join Date: Mar 2009
Posts: 46
Thanks: 2
Thanked 3 Times in 3 Posts
Default

Ok, I solved it with this .htaccess file:
Code:
Options +FollowSymlinks
RewriteEngine on

RewriteBase /repertoire_hard/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/([^/]*)\.php$ script.php?var1=$1&var2=$2 [L]

RewriteBase /repertoire_hard/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]*)\.php$ script2.php?var=$1 [L]
When trying to make them work, use [R] to see where your redirects point.
Reply With Quote
The Following User Says Thank You to gring For This Useful Post:
falko (13th February 2011)
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
500 Internal Server Error BoloMarkIII Installation/Configuration 4 21st October 2010 16:56
Webmin upgrade lishaw1968 Installation/Configuration 15 26th August 2010 15:23
Email problem 'Cannot set my user or group id.' (using ISPConfig 3 + OpenSuSE 11.2) urosm Installation/Configuration 5 19th June 2010 22:41
Forbidden 403; Samba access; config of maildeamon fawkes Installation/Configuration 4 14th January 2010 18:16
can't help ispconfig to install please help steve51184 Installation/Configuration 17 20th February 2009 10:37


All times are GMT +2. The time now is 15:09.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.