How To Exclude File from Wordpress Redirect?

3 replies
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
#exclude #file #redirect #wordpress
  • Profile picture of the author gaetanoc
    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]
    Signature
    An experienced technical programmer wants to JV with you


    I will build any kind of software, bots, web applications, desktop applications, mobile applications - you will handle marketing and sales.
    {{ DiscussionBoard.errors[9795007].message }}
  • Profile picture of the author gaetanoc
    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
    Signature
    An experienced technical programmer wants to JV with you


    I will build any kind of software, bots, web applications, desktop applications, mobile applications - you will handle marketing and sales.
    {{ DiscussionBoard.errors[9795419].message }}

Trending Topics