htaccess mod rewrite

adamr_carter96

New Member
Messages
5
Reaction score
0
Points
0
Hi all.

I've been here for a little while now, and have started using htaccess.

I'm trying to remove a get parameter from the url, and make it look like a subpage.

User types "mydomain.com/page"
But the page loaded is "mydomain.com/index.php?q=page"

I know this can be done using htaccess, there is alot of stuff on the web about it.

I've tried many things, but nothing seems to work.

I wondered whether mod_rewrite was enabled, but there are endless posts asking this, with answers saying it is.

Could it be because we have litespeed servers?

Thanks in advance for your help.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
It is enabled. It does work.

If you post your .htaccess, we can perhaps help.
 

adamr_carter96

New Member
Messages
5
Reaction score
0
Points
0
Thanks.

Here's the offending bit;

Code:
RewriteEngine On


Options +FollowSymlinks


RewriteRule ^home/([.]+) http://adams-site.x10.mx/home.php?page=$1 [NC]


When I try going to "http://adams-site.x10.mx/home/something, I get the 404 error page.

Thanks again.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
RewriteRule ^home/([.]+) http://adams-site.x10.mx/home.php?page=$1 [NC]

means "one or more periods"

A period "." inside [ ] looses its special meaning of "any character"

Try

RewriteRule ^home/(.+) http://adams-site.x10.mx/home.php?page=$1 [NC]

Also, do you really want them to request the page again? That is what you are doing. If not, try

RewriteRule ^home/(.+) home.php?page=$1 [NC]
 
Last edited:

adamr_carter96

New Member
Messages
5
Reaction score
0
Points
0
Thanks for that!

It works perfectly (apart from a .php on the end, but I can sort that myself)

Thanks again, acarter96.
 
Top