PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue May 23, 2017 5:37 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Oct 24, 2013 11:40 am 
Offline
Forum Newbie

Joined: Thu Oct 24, 2013 11:31 am
Posts: 3
Hello everyone.
I am pulling my hair out trying to get my .htaccess file to allow a domain such as mydomain.com/something/someone

Here is my code so far:
Code:
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%2://%1%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?page=$1 [QSA,L]


I have tried all sorts, but still cant get this thing working! The code I have posted removes the use of www. before my site, and allows one variable such as mydomain.com/index.php?page=XXX, I just cant get another one working, I would like mydomain.com/index.php?page=hello&section=goodbye.

Any help is much appreciated.
Tom.


Top
 Profile  
 
PostPosted: Thu Oct 24, 2013 12:42 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6418
Location: WA, USA
That should work by rewriting to index.php?page=something/someone. How is it not working? 404? Showing the wrong page?


Top
 Profile  
 
PostPosted: Thu Oct 24, 2013 2:55 pm 
Offline
Forum Newbie

Joined: Thu Oct 24, 2013 11:31 am
Posts: 3
I have managed to figure something out

Code:
RewriteRule ^(.*)/(.*)$ index.php?page=$1&section=$2


This works as I want it to, but only if I remove

Code:
RewriteRule ^(.*)$ index.php?page=$1 [QSA,L]


From my htaccess file. Is there a way I can get them both working simultaneously?


Top
 Profile  
 
PostPosted: Thu Oct 24, 2013 3:51 pm 
Offline
Forum Newbie

Joined: Thu Oct 24, 2013 11:31 am
Posts: 3
I found the solution here for anyone else who finds this problem:

http://stackoverflow.com/questions/14786340/rewrite-url-with-htaccess-for-multiple-parameters


Top
 Profile  
 
PostPosted: Tue Dec 16, 2014 7:18 am 
Offline
Forum Newbie

Joined: Tue Dec 16, 2014 7:16 am
Posts: 1
That should work by rewriting to index.php?page=something/someone. How is it not working? 404? Showing the wrong page?

_________________
kaleem


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group