Forum Moderators: phranque
This is my rewrite rule:
RewriteRule ^category([0-9]*)/index\.html$ index.php?c=$1 [L]
It converts this:
[mydomain.com...]
into this:
[mydomain.com...]
The first page contains links like this: [mydomain.com...]
... which are processed by the rewrite rule once they are clicked.
Unfortunately the destination page inherits links like this:
[mydomain.com...]
Instead of:
[mydomain.com...]
Basically, "category1" gets stuffed in every URL although I don't intend for it to be that way. This gives me "not found" errors everywhere.
Any ideas on how to fix it? What kind of rewrite rule should I add to htaccess file to correct the problem?
RewriteBase /category1
or
RewriteBase /category2
depending on where your .htaccess file with the rewrite is located.
That may not do it. If not, re-post your directory layout, your .htaccess location, your .htaccess rules, and specify the exact file locations relative to web root and the format of the links they contain -- This all gets a bit confusing since we're not familiar with your directory/URL layout and can't look over your shoulder.
Also, some rewriterules may effect others, and sometimes the way to prevent it is to add more rules. Other times it is to add exclusions to existing rules.
Jim
I had the same issue with images on the destination page - now the difference is that the problem is with the links on the same destination page.
To solve the image problem you gave me the RewriteRule suggestion ^category1/images/(.*)$ /forum/images/$1 [L].
This prevented the images from being searched in the forum/category1/images/ directory. Instead it searched in the forum/images/ directory and produced the right outcome.
The same problem persists with the links, because they are also relative: href="category2/page.html". When the address bar says .../category1/index.html, the "category2/page.html" relative link gets appended to form .../category1/category2/page.html instead of just .../category2/page.html. I plan to make all links absolute, but I'm still wondering if there is a way, the same as for the images, to solve the link problem using RewriteRule.
Thanks.
By the way, my htaccess file is in the forum/ directory.
Jim
This thread refers to a previous thread at: [webmasterworld.com...]