# Htaccess - different when logged in

**URL:** <https://www.phphelp.com/t/htaccess-different-when-logged-in/35149>\
**Category:** Uncategorized\
**Created:** [December 7, 2022, 12:45pm UTC](https://www.phphelp.com/t/htaccess-different-when-logged-in/35149 "2022-12-07T12:45:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![j84](https://www.phphelp.com/letter_avatar_proxy/v4/letter/j/b2d939/32.png) [@j84](https://www.phphelp.com/u/j84)\
**Post date:** [December 7, 2022, 12:45pm UTC](https://www.phphelp.com/t/htaccess-different-when-logged-in/35149/1 "2022-12-07T12:45:30Z")

</div>

Hi I have a login system for members only.

Users login at index.php  
When a users is correctly logged in it will redirect to main.php in same folder.  
And uses this → main.php?page=start

in my htaccess I have this:

```auto
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

RewriteRule ^(.*)$ main.php?page=$1 [L]

```

It works but I want to add when in index.php  
I would like to check if there is a variable set - index.php?color=red  
but instead of showing the url I want the variable to be like this: /red  
so if I got to my domain for [example.com/red](http://example.com/red) - \> I will get a color variable that is ‘red’.

I tryed this but I think the confuse each others =)

```auto
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

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

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

```
