Luvias
Luvias

Reputation: 570

Rewrite a URL to homepage

The URL I want to rewrite is: http://domain.com/index.php?name=home to http://domain.com/.

I have created the .htaccess file and put this code for rewrite:

RewriteEngine On 
RewriteRule ^ index.php?name=home [L]

But it doesn't work. All requests in my site will redirect to http://domain.com/. Help me to fix this. Thanks you!

Upvotes: 1

Views: 348

Answers (2)

Hashes
Hashes

Reputation: 120

This is generally because of the structure of your page calls , since I dnt know the sources of your files and how you implementet over ftps , you need to organize your pages , there should be a folder called public this folder usually contain your public pages in that .htaccess as well as your script files.

Upvotes: 1

Jon Lin
Jon Lin

Reputation: 143906

You need to add an "end of string" match to your regex:

RewriteEngine On 
RewriteRule ^$ index.php?name=home [L]

Upvotes: 2

Related Questions