close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

URL rewrite syntax

Thread began 6/23/2014 11:54 am by iainmacdonald331081 | Last modified 5/05/2016 12:57 am by Ray Borduin | 1135 views | 6 replies |

iainmacdonald331081

URL rewrite syntax

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

I have a URL rewrite that rewrites:

www.mysite.com/myfolder/index.php?myfield

as

www.mysite.com/myfolder/myfield/

Which looks like:

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

However, I now need it to rewrite:

www.mysite.com/myfolder/index.php?myfield

as

www.mysite.com/myfield/

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

Sign in to reply to this post

Jason ByrnesWebAssist

your original URL is not valid.

URL variables should have a name value pair, for example:
?variable=value

if you have the originbal URL as:
www.mysite.com/myfolder/index.php?myvariable=myfield

that would be more correct. and you could use the following rewrite rule:

RewriteEngine On
RewriteRule ^([^/]*)/$ /myfolder/index.php?myvariable=$1 [L]

I used the mod rewrite generator here to find that:
http://ipdistance.laserprinterdrivers.com/mod_rewrite.php

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - yes, that was a typo in my original post - I did mean as you put it above.

I currently have a .htaccess file in the www.goodsafariguide.com/africa/ folder which looks like:

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

In an example where the GSG_URL value = alfajiri, this works:

www.goodsafariguide.com/africa/alfajiri/

But not what I'm trying to get:

www.goodsafariguide.com/alfajiri/

Sign in to reply to this post

Jason ByrnesWebAssist

I cant offer a lot of support for htaccess, but:

"I currently have a .htaccess file in the www.goodsafariguide.com/africa/ folder"

it seems to me that if you want to force the URL To the root, the htaccess file needs to be in the root, not the sub folder.

If you need further support, you should post to a forum that deals more specifically with mod rewrite

Sign in to reply to this post

iainmacdonald331081

Thanks for your help Jason - I'd seen a few other sites bout rewrites, but that one above looks the best I've seen.

I had posted elsewhere too - I know that with this sort of thing any help you guys can give is a bonus.

I pretty much have it working, but there are WordPress blog posts on the site which is causing a few issues. So the pages I want to appear all work, and most of the existing blog pages are unaffected, but a few of the blog pages display as the lodge.php page with no data.

UPDATE - think I have resolved it now - looks like blog posts with a / at the end of the URL were causing the page to break. But with no / they are fine.

Sign in to reply to this post

jo271221

url rewrites

If I use an url rewrite mysuperpage/index?userid=456 as mysuperpage is there any way to still link from other pages of the site to a specific user id.

Sign in to reply to this post

Ray BorduinWebAssist

You can create your links with the same rewritten syntax. You will still have to pass the data somehow. So you could use a syntax like:

mysuperpage/456

Then have a mod rewrite that translates that to: mysuperpage/index.php?userid=456

and so on for any other pages you want to pass variables to.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...