0

Hello! I'm working on a profile page, I already have the first get variable redirect working so it goes from
mywebsite.com/u/?u=username to mywebsite.com/u/username, as an example. But I want to pass a second parameter as such: mywebsite.com/u/username/about for example. So I wrote (more like mashed a bunch of scavenged code together, not good with htaccess) this in my .htaccess:

RewriteBase /u
Options +FollowSymLinks
RewriteEngine on

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

RewriteRule ^(.*)$ index.php?u=$1
RewriteRule ^(.*)/(.*)$ index.php?u=$1&mode=$2

When using the second get variable so when i go mywebsite.com/u/username/about it returns index.php. I didn't know where to post this so I put it in the php section since it has to do with get variables. Anyways thanks for any help!

Edited by NardCake

3
Contributors
2
Replies
5
Views
4 Years
Discussion Span
Last Post by diafol
0

@NardCake

When using the second get variable so when i go mywebsite.com/u/username/about it returns index.php. I didn't know where to post this so I put it in the php section since it has to do with get variables. Anyways thanks for any help!

Usually all .htaccess questions are answer here at PHP section.

Explain more clearly how you want the variable to passed:

From this:

mywebsite.com/u/username/about 

to this

mywebsite.com/u/username/about/index.php?

This is how you redirect from an old index2.php to a new index.php

Redirect /index2.php mywebsite.com/index.php

This one is to rewrite the link:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^about\.php$ "http\:\/\/www\.mywebsite\.com\/index\.php" [R=301,L]

If that's not what you want, then explain more how link should look.

This is a link I usually used a as reference to look back to do Rewrite URL:

http://www.cyberdesignz.com/blog/website-design/url-rewriting-top-5-ways-of-php-url-rewriting/

Edited by LastMitch: grammer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.