Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Mod Rewrite assistance

Status
Not open for further replies.
Joined
Mar 13, 2005
Posts
4,662
Reaction score
184
I hate mod rewrite and dont think I've ever managed to get it to work from scratch.

I have these two urls:

domain.co.uk/directory/test.php?category=name

domain.co.uk/directory/test.php?category=name&page=1

Which I would like to rewrite to:

domain.co.uk/directory/category/name

domain.co.uk/directory/category/name/1


Can anyone please give me the line(s) that need to go in the .htaccess file to make this work?

Appreciated, Grant
 
POSTED IN another thread by me but here you go.

Just thought i'd add this as YES it is good we can edit WP to help with SEO as it did seem a little naff if the paths were not editable using the permalinks option before activating the All-In-One-SEO plugin for WP as it only works on Linux Servers.


So here goes the fix for it

If you have access to the server install the following software - "ISAPI rewrite" and select the domain you wish to make SEO freindly then the button EDIT
Then enter the following.

# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.23
# BEGIN WordPress
RewriteEngine On
RewriteBase / add e.g. /blog if in a different folder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]
# END WordPress

This creates a .htaccess file.

Then in the wp-includes folder edit the file classes.php on line 46 ish comment out the line
$req_uri = $_SERVER['REQUEST_URI'];
like below-
//$req_uri = $_SERVER['REQUEST_URI'];
And add the following line straight after it-
$req_uri = $_SERVER['HTTP_X_REWRITE_URL'];

The first line is for linux and is not used the second line is for windows and active.


Going back to the WP dashboard under OPTIONS - PERMALINKS use something simular as image.


Hope this helps some WP hardcores to SEO to the MAX.
 
ermm just woken up, but something like so Grant


RewriteRule ^directory/([a-zA-Z0-9_]*)/([a-zA-Z0-9_]*).* directory/test.php?category=$1&page=$2
 
Status
Not open for further replies.

Rule #1: Be Respectful

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Siusaidh AcornBot:
    Siusaidh has left the room.
      Siusaidh AcornBot: Siusaidh has left the room.
      Top Bottom