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
https://forums.phpfreaks.com/topic/237377-help-re-write-issue/
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
https://forums.phpfreaks.com/topic/237377-help-re-write-issue/#findComment-1219797
Share on other sites

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.