Jump to content

making www.domain.com/index.php?page=shows rewrite to www.domain.com/_pages/show


sinister1

Recommended Posts

Hi,

 

I am totally new to mod rewrite. Did a lot of digging around trough google. Seen a lot of posts on this website regarding rewriting.

 

I have a website with a url structur like www.domain.com/index.php?page=shows  i want to rewrite this to www.domain.com/_pages/shows

 

is this possible and if so how do i do that? i've tried several options:

 

Option 1:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?page=$1 [L]

 

Option 2:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/index.php

RewriteRule ^(.*)/$          index.php?page=$1 [L]

 

can anyone help me out here?

Link to comment
Share on other sites

"I have a website with a url structur like www.domain.com/index.php?page=shows  i want to rewrite this to www.domain.com/_pages/shows"

 

 

Technically you want domain.com/_pages/shows to be rewritten to domain.com/index.php?page=shows, not the other way around.

 

 

 

 

 

Anyway:

 

RewriteRule ^_pages/([^/]+)/?$ /index.php?page=$1

 

 

 

 

 

Oh, using ^(.*)$ doesn't make sense by the way.  ^ is the begin anchor, and $ is the end anchor, so it doesn't make sense to allow any amount of anything and have start/end anchors.

 

Also, (.*) would grab everything, so you would get index.php?page=_pages/shows.

Link to comment
Share on other sites

Make sure you left

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

 

in there or it is possible that the requests to the CSS files are being rewritten.

 

 

 

And yes, you will either need to rewrite CSS files (not recommended) or you will need to use absolute paths.

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.