Jump to content

Help - Re-Write Issue


fry2010

Recommended Posts

Ok, I will try to explain this as easy as I can.

 

I want to navigate to 'www.bargainadds.co.uk/local-adverts/general'.

Yet I want this to instead redirect to 'www.bargainadds.co.uk/adverts' and give the 'general' part as a GET variable.

So basically I am looking to change it to 'www.bargainadds.co.uk/adverts.php?$i=general'

 

The 'general' part may change, because it is a variable.

 

It is just displayed as folders even though I want it to convert to the /adverts.php?i=... part.

 

The problem is I already have some code that redirects pages without the file to the index.php file in the folder if one exists,

here is the .htaccess file:

 

        Options +FollowSymlinks
        RewriteEngine on
RewriteBase /



RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


RewriteCond %{HTTP_HOST} ^bargainadds.co.uk
RewriteCond %{HTTP_HOST} !^bargainadds.co.uk/local-adverts/(.*)$
RewriteRule (.*) http://www.bargainadds.co.uk/$1 [R=301]

 

As you can see I have attempted to stop this from working on the 'bargainadds.co.uk/local-adverts/(.*)$' part but it does nothing. It still gets directed to the index, when it should be saying page not found.

Link to comment
Share on other sites

I have had this working on my local computer:

 

  RewriteCond %{REQUEST_URI} ^/www.bargainadds.co.uk/local-adverts/(.*)$
  RewriteCond %{REQUEST_URI} !^/www.bargainadds.co.uk/local-adverts/images/(.*)$
  RewriteCond %{REQUEST_URI} !^/www.bargainadds.co.uk/local-adverts/discount-slip(.*)$
  RewriteCond %{REQUEST_URI} !^/www.bargainadds.co.uk/local-adverts/search(.*)$
  RewriteRule ^(.*)$ /www.bargainadds.co.uk/adverts.php?q=$1 [L,QSA]

 

But it does not work on live. I have also tried changing the %{REQUEST_URI} part etc..

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.