First post here, but I'm pretty sure this is the right forum
Anyway, I have an index.php file that requests an image based on a parameter in teh url. However, this looks really ugly to the user. How would I go about using a rewrite to change something like
Surely you're not referring to $_GET[param] are you? In PHP, anything past the question mark can be accessed using $_GET[]. What you would do is put all your code in the index.php file and then in the php code you would use $_GET[param] to get that parameter in the url.
Anything past the ? is a parameter, with & serving as the delimiter between parameters. A $_GET parameter has a name and a value, for the example above we have a parameter with name param and value 450, and a parameter with name other and value party. To echo it in php, you would say:
I guess I'm not explaining myself very well. THe user goes to the site http://domain.com/405/. As far as the user is concerned, they are at domain.com/405/. The system internally reads domain.com/405 as domain.com/index.php?param=405, which allows me to access the parameter for content on the page, while the user only sees domain.com/405/.
Have you even been far as decided to use even go want to do look more like?
i didnt say use a whole new framework. i said use a uri class, and that codeigniter has one built in. you can google 'php uri class' and get a ton of entries on the matter. its not that hard.
Ah, I looked into some of the syntax for this and I see a few things wrong. /d would would except there isn't a directory there, and although !/d might work in theory, I could just use numbers instead.
RewriteEngine on
RewriteRule ^([0-9]+)/?$ /index.php?comic=$1
RewriteRule ^([0-9]+)$ /index.php?comic=$1
solved it for me. Thanks anyway!
Have you even been far as decided to use even go want to do look more like?