Jump to content

clean url question with .htacess


emehrkay

Recommended Posts

I've done some looking around and I dont know if what I am looking for has been talked about.

 

I have apache running, but it is a shared server (for now) so I figured htaccess would be my only weapon in this matter.

 

What I want to do is use an MVC-like approach but have more than just the index page.

 

So I want the urls to read like

 

site.com/users/emehrkay/bio

 

and before i would impliment the clean url scheme, it would read

 

site.com/users.php?user=emehrkay&section=bio

 

so just like in the first example, you can do site.com/page/var/var with page and var all being variable

 

is that possible? users.php isnt the only page that there will be.

 

Does that make sense? Ill do some more reading on the subject and see if I can find anything.

 

Thanks

Link to comment
Share on other sites

If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at:

 

Options +FollowSymlinks

RewriteEngine On

RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1&section=$2

 

...and just repeat rewrite rules like for each different thing you want to do?

Link to comment
Share on other sites

If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at:

 

Options +FollowSymlinks

RewriteEngine On

RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1&section=$2

 

...and just repeat rewrite rules like for each different thing you want to do?

 

ahh very simple, thank you. now i just need to get my htaccess file working locally so i can test it

Link to comment
Share on other sites

  • 2 weeks later...

If I am understanding your question correctly, couldn't you do that with something like this in an .htaccess file in the directory your site is at:

 

Options +FollowSymlinks

RewriteEngine On

RewriteRule ^users/(.*)/(.*)/?$ /users.php?user=$1&section=$2

 

...and just repeat rewrite rules like for each different thing you want to do?

 

ok i used this to replace my query strings, just like you wrote it print_r*$_GET) works fine, the variables are shown. but the page doesnt work anymore. I dont know what the problem is, it seems like it works as it should but without the css. I look at the css editor in the webdeveloper toolbar and it is filled with the page's html. am i doing something wrong?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.