2

I would like to rewrite the following url:

index.php/variable where variable can be any name such about,contact, etc.

to page/variable or page/variable/ where variable can be any non case-sensitive character.

Essentially the user would access page/variable or page/variable/ which would rewrite the url of the index.php/variable

I have tried the following:

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

but that has not been successful.

1
  • 1
    In theory these rules should work. Commented Aug 10, 2015 at 11:01

1 Answer 1

1

You can use one rule for both actions:

RewriteEngine On RewriteRule ^page/([^/]+)/?$ /index.php/$1 [NC,L] 

This will internally redirect a url ending with or without a slash to "/index.php/$1"

Sign up to request clarification or add additional context in comments.

1 Comment

would it also be possible to make a request url rewrite so that when somone type index.php/about for instance it translate to page/about

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.