Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   How To Exclude File from Wordpress Redirect? (https://www.warriorforum.com/programming/1034388-how-exclude-file-wordpress-redirect.html)

John Hocking 7th January 2015 11:21 AM

How To Exclude File from Wordpress Redirect?
 
I have a Wordpress site and am trying to create a friendly url for an affiliate link masker.

I have a file called hoplink.php and I need to pass a value vin=xxxxx but I want to include the url like domain.com/hoplink/xxxxx

I have tried the code below in the htaccess file but it seems to still be picked up by wordpress and treated as a 404.

Any Help would be appreaciated.


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^hoplink/([A-Za-z0-9-]+)/?$ hoplink.php?vin=$1 [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

John Hocking

gaetanoc 7th January 2015 11:56 AM

Re: How To Exclude File from Wordpress Redirect?
 
Make sure you are editing the root .htaccess.

The following is an example I have found for you.

Code:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+download.php?id=([0-9]+)&name=([^s&]+)s [NC]
RewriteRule ^ download/%1/%2? [R=301,L]
RewriteRule ^download/([0-9]+)/([^/]+)/?$ download.php?id=$1&name=$2 [L]


John Hocking 7th January 2015 01:01 PM

Re: How To Exclude File from Wordpress Redirect?
 
Thank You.

I will give it a try.

gaetanoc 7th January 2015 03:19 PM

Re: How To Exclude File from Wordpress Redirect?
 
let me know if you still have a problem. I will set up an example on my local development machine and make sure it is working like you need it


All times are GMT -6. The time now is 01:06 PM.