Jump to content

Is this rewrite rule possible?


AdRock

Recommended Posts

Can you rewrite a rule so you get something like

[url=http://www.mysite.com/somepage/1]www.mysite.com/somepage/1[/url]

from this

[url=http://www.mysite.com/index.php?page=something_1]www.mysite.com/index.php?page=something_1[/url]

I have about four pages named something_1, something_2 etc and don't know if i need a rewrite rule for each page
I was thinking of something like

[code]RewriteRule ^somepage/([0-9]+)/?$ index.php?page=something_$1[/code]

but i don't know if this is right
Link to comment
https://forums.phpfreaks.com/topic/19707-is-this-rewrite-rule-possible/
Share on other sites

This is my current .htaccess file

[code]Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^([A-Za-z0-9\-_]+)/?$ index.php?page=$1
RewriteRule ^gallery/([A-Za-z0-9\-_]+)/([0-9]+)/?$ index.php?page=$1&id=$2
RewriteRule ^([A-Za-z0-9]+)/([0-9\-_]+)/?$ index.php?page=$1&pagenum=$2
RewriteRule ^admin/([A-Za-z0-9\-_]+)/?$ admin/index.php?page=$1 [L] [/code]

which works fine.  I can change index.php?page= to just the pagename

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.