Jump to content

Recommended Posts

Hey everyone

 

I'm trying to make multiple modrewrite rules but as soon as i add more than one the others stop working...

 

here's what i'm trying to do

 

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)\.html index.php?page=$1
RewriteRule ([^.]+)-([^.]+)\.html index.php?page=$1&section=$2
RewriteRule ^([^.]+) profiles/index.php?folder=$1 [L]

If i remove the ?page=$1 and/or ?page=$1&section=$2

 

then profiles will work, but if i remove the profiles ?page=$1 will work but the ?page=$1&section=$2

never works :(

 

Any one have a suggestions and i'll be adding alot more after this

Link to comment
https://forums.phpfreaks.com/topic/84243-multiple-rewrite-modifications-help/
Share on other sites

OKay i kinda have this working

 

Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^/]+)/ profiles/index.php?folder=$1&%{QUERY_STRING}$

RewriteRule ([^.]+)\.html index.php?page=$1&%{QUERY_STRING}$

RewriteRule ([^.]+)-([^.]+)\.htm index.php?page=$1&section=$2&%{QUERY_STRING}$

 

 

Works but i have to use / at the end of the profiles rewrite , i have to seperate the page=&section with .htm not .html because that won't work... ideas?

 

If using .htaccess then you have no RewriteBase specified so it's kinda hard to debug without knowing what context you're using these rules in. Also the 2nd example has no last rule flag [L]

 

Might be better to state what you're trying to actually achieve in the first place as there might be a simpler or possibly more robust and easier-to-debug method of doing the job. One could debug the syntax of your current rule only to find that it still doesn't do what you really want it to. (and up to know you've not clearly stated what you're trying to achieve)

 

Are you simply trying to redirect to (or rewite to) physical folder by use of parameters?

If so then see ttp://www.phpfreaks.com/forums/index.php/topic,175410.0.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.