Heya,
So I'm trying to convert:
http://www.mywebsite.com/?title=page-title-goes-here
- to -
http://www.mywebsite.com/page-title-goes-here
I'm looking for a dynamic way of doing this so anytime the user goes to "page-title..." it keeps the clean URL but tells my PHP that "page-title..." is ?title...
Does this make sense? Thanks!
What's the best method for clean URLs?
Moderator: General Moderators
-
WithHisStripes
- Forum Contributor
- Posts: 131
- Joined: Tue Sep 13, 2005 7:48 pm
Re: What's the best method for clean URLs?
You should use Mod Rewrite.
.htaccess:
.htaccess:
Code: Select all
RewriteEngine On
RewriteRule ^([-a-zA-Z0-9]+)$ index.php?title=$1
-
WithHisStripes
- Forum Contributor
- Posts: 131
- Joined: Tue Sep 13, 2005 7:48 pm
Re: What's the best method for clean URLs?
Okay - so I've been trying that method but I must be doing something wrong.
So I enter:
Then what URL do I go to to visiti http://www.sample.com/?title=sample ?
Thanks!
So I enter:
Code: Select all
RewriteEngine On
RewriteRule ^([-a-zA-Z0-9]+)$ index.php?title=$1
Thanks!
Re: What's the best method for clean URLs?
If you have done anything correctly, then:
http://site.com/sample = http://site.com/index.php?title=sample
http://site.com/query-name = http://site.com/index.php?title=query-name
Aliasing.
You can use both URLs.
http://site.com/sample = http://site.com/index.php?title=sample
http://site.com/query-name = http://site.com/index.php?title=query-name
Aliasing.
You can use both URLs.
-
WithHisStripes
- Forum Contributor
- Posts: 131
- Joined: Tue Sep 13, 2005 7:48 pm
Re: What's the best method for clean URLs?
Whoops, my mistake.
I was uploading .htaccess somewhere other than it belonged.
Thanks!
I was uploading .htaccess somewhere other than it belonged.
Thanks!