Change page names in URL

luca85

New Member
Messages
24
Reaction score
0
Points
0
Hi,

First of all I hope I posted this in the right section. If not, please forgive me. :redface:

Secondly, I made a website using Reptile and is hosted here on x10. I don't know a lot about programing but I would like to do this little thing:

Change this URL that shows up when I'm on the Contact page

http://www.NAME.com/index.php?p=1_2_Contact

to

http://www.NAME.com/Contact

Also I would like to do this for all the pages.

Should I change some names in cPanel?

Any pointers will be appreciated.

Thanks.
 

techairlines

x10 Flyer
Community Support
Messages
2,867
Reaction score
165
Points
63
Try adding a file called .htaccess (hidden dot file) into your public_html root directory. To do this, simply create a blank txt file and rename it into .htaccess (no name, only a file extension). If you're doing this from inside cPanel, make sure you have Hidden Files checked off.

Then inside, add the following lines:

Code:
RewriteEngine On 
RewriteRule ^contact/?$ index.php?p=1_2_Contact [NC,L]

This is known as a basic URL mod_rewrite.
 
Last edited:

luca85

New Member
Messages
24
Reaction score
0
Points
0
Thanks for the reply.

I already have that file in public_html and it looks like this
_________________________________________________________________
RewriteEngine on

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName NAME.com (edited)
AuthUserFile /home/NAME/public_html/_vti_pvt/service.pwd (edited)
AuthGroupFile /home/NAME/public_html/_vti_pvt/service.grp (edited)

RewriteCond %{HTTP_HOST} ^NAME$ [OR] (edited)
RewriteCond %{HTTP_HOST} ^www.NAME.com$ (edited)
RewriteRule ^/?$ "NAME" [R=301,L] (edited)
RewriteRule ^contact/?$ index.php?p=1_2_Contact [NC,L] (added now)
___________________________________________________________________

I have added the last line to the file and saved it but nothing happened to the website's URL.

Should I change something else in there?
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Did you try the URL?

Note that the rewrite engine lets you access a given resource with a given URL. In no way does it alter the source of web pages; you'll have to do that on your own. If you're using something to generate your pages, it limits how much you can change. Read through the mod_rewrite documentation to learn exactly what its capabilities are.
 
Top