Sarthak Patel
Sarthak Patel

Reputation: 173

.htaccess url rewriting

I need a rewrite rule to rewrite the following:

www.abc.com/page/xyz to www.abc.com/xyz
remove **"page"** from url

Upvotes: 2

Views: 162

Answers (3)

Jesse Kochis
Jesse Kochis

Reputation: 770

I think it's more like this:

RewriteBase /
RewriteRule ^(.*)$ page/$1 [L]

If I understand what you're trying to do.

Upvotes: 2

qbert220
qbert220

Reputation: 11556

If you only want to redirect page/xyz then you can use:

RewriteEngine on
RewriteRule ^/page/xyz$ /xyz [L]

If you want to redirect anything within the page directory, then use:

RewriteEngine on
RewriteRule ^/page(/.*$)$ $1 [L]

Upvotes: 1

Denis de Bernardy
Denis de Bernardy

Reputation: 78561

Like so:

RewriteBase /
RewriteRule ^page(/.*)?$ $1 [L]

Upvotes: 2

Related Questions