Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Mod Re-Write Help

Status
Not open for further replies.
Joined
Feb 14, 2008
Posts
2,230
Reaction score
54
I posted about this some time ago and cant seem to find my old post. Ive looked everywhere but will to resort to posting again.

I would like to SEO the following urls but not quite sure on the mod re-write.

example.com/?pg=home to example.com/

and example.com/?pg=albums to example.com/Music-Albums

Thanks in advance, Darren.
 
Jeewhizz seems pretty good on mod_rewrite :)

My regex skills suck ass :(

I generally do manual re-write for myself but thats a nasty way of doing them.
 
Try this (untested):

Code:
RewriteEngine On

RewriteRule ^$ index.php?pg=home [L,NC]
RewriteRule ^Music-Albums/?$ index.php?pg=albums [L,NC]
 
Thats what I was meaning my manual rewrites :)

I was thinking he was meaning to pull the name Music Albums from the php like the forum does with mod-re-write-help. I hate RegEx but like normalisation it will strike me like a bolt of lightening and make sense :)
 
Will have to be manual using his examples, as mod_rewrite can't automatically figure out that

Music-Albums/

should =

?pg=albums
 
Thanks for the current replies. Im just awaiting DNS update and i will let you know if it works.

Im a complete noob to mod_rewrite, thats another book to add to the list.

Thanks, Darren.
 
Prob better looking at Regular Expressions books before looking at mod_rewrite, I tend to get a major headache over regex.

Jee, I'm good at over thinking idea's, its my promotions background, with the php thing, I'd assumed music albums was dynamically set, so the script would have to return that and pass it on to rewite it, prob my bad :p heh
 
These seems to give me a "500 Internal Server Error".

Thanks, Darren.

Edit: I was missing ] when copied over, now the site works but no changes to URL.
 
Last edited:
I think you might need something like this:

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^example.com /?pg=home [NC,QSA,L]
RewriteRule ^Music-Albums /?pg=albums [NC,QSA,L]

It might be best to try the:

RewriteRule ^Music-Albums /?pg=albums [NC,QSA,L]

first by itself, I'm not sure if the example.com might not work in the first line.

Then again it might not work at all :D
 
You should be able to type

example.com/Music-Albums

and it loads the other page.

Does that not work ?
 
dashu1: I get the same result as before.

Skinner: Yes that works by typing in the URL like that.

I might not of explained myself well enough, im looking to change the url in addresse bar for SEO purposes etc.
 
Thats what Mod_Rewrite does, means you can use

blah.com/Music-Albums

instead of blah.com/w9e/dna/index.php?page=blahd or whatever :)

Theoretically your users would never see the other page, thus you promote the /music-albums/ instead :)
 
p.s. not sure why its including the ?pg= bit, it shouldn't show that

You should just have

blah.com/music/
blah.com/films/
blah.com/bio/

Then set your internal links to match them.
 
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^example.com /?pg=home [NC,QSA,L]
RewriteRule ^movies /?pg=movies [NC,QSA,L]
 
If you delete ",QSA" as in comma QSA that will remove the ?pg=blah bit from the rewrote address :)

I didnt see Dashu's post, until I wondered where the QSA (Query String Append) came from :)
 
Are you sure that the mod_rewrite module is installed on the server?

Alternatively is it an apache server?

Or have you put the .htacess file in the root?
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom