I'm not sure at what point you want to use this... post login... link from page... etc. but there are a couple of ways to do it.
Easiest would be to set a session variable with your login...
$_SESSION['test'] = $username;
That variable would remain until the user logged out or session timed out.
I am using session and that I have no issues, but idk how to access my session from the .htaccess file
.htaccess is an apache web server configuration file, there should be no way for it to parse and access the data in a session file that is created by php.
With this in your .htaccess file whenever someone visits
it will call the /index.php script as if they entered http://yoursite.com/index.php?user=asdf to get to the page
If you want to print the link to the page you'd use
This sounds promising! I sure hope it works! I am gonna try it out now.
Well I have tried it and it doesn't work. I don't know why. I went and tested my .htaccess file and it is working, but that above isn't working...
how can make file html will processed as php file?
in my old site i use
AddType application/x-httpd-php .html
but in my new site not work
all html file not open at browser, but downladed same like we download a content from site.
i already try each below
AddType application/x-httpd-php5 .html
AddHandler application/x-httpd-php .html
AddHandler application/x-httpd-php5 .html
still not work
Not that sure since I am not good with .htaccess stuff.
I tested AddType application/x-httpd-php .html and that works for me here on frihost.
For more flexibility, you could rewrite ALL incoming requests to index.php (or some other front script). By ALL I mean excluding files which exist already (you don't want to rewrite requests for images to index.php) and favicon.ico (which browsers will request automatically, assuming that it exists).
Then if someone requests http://example.com/some/page, $_GET['q'] == 'some/page'.
Like hiwaypilot wrote the easiest way is sessions. If you are using sessions why you need $_GET. Session is always available via session_start and you don't need to rewrite urls. $_GET is not session function.
I still can't figure out what what to do.
I have this in my .htaccess file.
I go to http://mywebsite.com/user/test
It doesn't change to http://mywebsite.com/index.php?=test
It has been some time since I did any mod_rewrite but this rule doesn't look right
(.*) this will match any characters so if the user try to access mywebsite.com/user/test it will be translated to mywebsite.com/index.php?q=user/test. At least that what I think will happen. You can easily verify this by printing the value of $_GET['q']. I'm not sure about the QSA flag, have never used it myself.
Maybe this is more what you want?
.. still not sure about the QSA flag though.
Still doesn't work. I don't know why. Any ideas?
for other hosting, not frihost
Easy, you can rename the file for one normal name, save new parameters and will save using the original name:
.htaccess -> user_acess.txt
save new parameters into user_acess.txt
user_acess.txt -> .htacess