URL Rewrite syntax help

This might be an easy one for someone, if not don’t worry.

I have a URL rewrite that rewrites:




Which looks like:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/ index.php?GSG_URL=$1

However, I now need it to rewrite:




But can’t get anything I’ve tried to work.

My guess is you’ve got that rewrite rule in an htaccess file that lives under myfolder/. You’ll have to move that rewrite rule to the root.

Thanks Jeff.

So would I also need to move the page to the root as well?

I do think this might be one of those things were there are a few permutations, and its a case of getting them all in the right place at the right time!

ie, if I currently have a page


That might show


Which redirects to:


(By which I mean if you navigate to www.mysite.com/myfolder/myfieldvalue/ you see the page you would see at www.mysite.com/myfolder/index.php?myfield=myfieldvalue)

And has the .htaccess file inside the /myfolder/ folder.

Do you mean I need to move that to the root, and so

www.mysite.com/myfieldvalue/ will display what you would see at www.mysite.com/myfolder/myfieldvalue/ ?

I think I have this working now.

There is a WordPress blog on the site which confused the issue a little.

So I have the following .htaccess in the root folder:

Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/$ /lodges.php?GSG_URL=$1 [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

And am able to correctly display




It seemed to be working OK, but some of the blog posts were getting messed up - showing as mypage.php but with no data.

I think I have identified the issue being resolved by making sure the permalink of the blog article does not contain the / at the end of the URL.

i.e. if it does, the page gets messed up.

If it does no, the page is OK.

Think I have resolved this no - blog pages with a / at the end of the URL break.

But pages without the / at the end are OK.