Ihfaz
Ihfaz

Reputation: 25

Rewrite URL through .htaccess

My website generates page URL with the prefix ?Script=, which is not SEO-friendly.

I want to remove this prefix and just keep the page title.

For example, I want to convert the following URL:

example.com/?Script=about to example.com/about

about is the About page of my website.

I want to set up a rule for omitting ?Script= for all pages.

I have managed to do it for my blog post by using the following rewrite rule.

RewriteRule ^news/([0-9a-zA-Z_-]+) ?Script=news_view&uid=$1

Upvotes: 1

Views: 41

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

This should work for you .

RewriteEngine on

RewriteRule ^(about)/?$ /?script?=$1 [L]

If you have more pages , you can add those pages to the pattern

RewriteEngine on

RewriteRule ^(about|page2|page3)/?$ /?script?=$1 [L]

Upvotes: 1

Related Questions