views:

69

answers:

2

I have a wordpress website on my main domain

For the wordpress website i have this in my .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>

# END WordPress

I just created an addon domain and wanted to use new rules for it

I created a .htaccess file and put it inside the addon folder eg /newaddon

In the .htaccess file i have:

Options -Indexes

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&amp;cat=$2&amp;title=$3
</IfModule>

The url stucture i have is this:

http://www.website.com/readjob/3/jobs/web-designers-potech-integrated-services/

But it keeps telling me link is broken

I dont know what to do, pls i need assistance

(pls i just learnt mod rewriting today, so clarity will be highly appreciated)

Thanks

A: 

This is not HTML where the & should be represented with a character reference (except if used as a reference open delimiter). So:

RewriteRule ^readjob/(.*)/(.*)/(.*)/$ readjob.php?id=$1&cat=$2&title=$3

Furthermore, you should use a more specific pattern than .* like [^/]+:

RewriteRule ^readjob/([^/]+)/([^/]+)/([^/]+)/$ readjob.php?id=$1&cat=$2&title=$3
Gumbo
Gumbo, i did exactly what u said , i changed the rewriterule , it started displaying error 404 (im sure readjob.php is on server). when i remove the RewriteBase line the error changed "Oops the link is broken". Pls any clue?
Ogugua Belonwu
@Ogugua Belonwu: Are you using both .htaccess files on the same domain only in different folders (i.e. `/` and `/newaddon/`)?
Gumbo
Let me illustrate what i have: i have the main website: www.main.com, i have a .htacess file for the main website that works, inside the www.main.com folder i create another folder which houses an addon domain (www.addon.com) and put another .htaccess file in it to handle its modrewrite. This is the .htaccess that gives the problem. Hope is clearer, thanks
Ogugua Belonwu
@Ogugua Belonwu: Well, the rule in the .htaccess file in `/` is applied on all requests (as .htaccess is a per-directory configuration file). You can restrict that rule only on requests to *www.main.example* by adding this condition: `RewriteCond %{HTTP_HOST} =www.main.example`.
Gumbo
ok tnks on which of the .htaccess files do i put it
Ogugua Belonwu
@Ogugua Belonwu: Well, since that condition is only fulfilled if the host is *www.main.example*, I guess you rather want it in the .htaccess file for that domain.
Gumbo
Pls i put the line in the main website folder, i started the page nt found, pls these are two diff rewrite rules, i actually dnt have anything to do with the one in the main website, what im interested in is the htaccess in the addon domain folder, pls my head is goin bananas and boss is on my head
Ogugua Belonwu
@Ogugua Belonwu: I’m not quite sure in what order the .htaccess files are processed and depending on the configuration it might even be possible that .htaccess files in directories other than the document root directory are not even taken into account. So if you don’t have access to the .htaccess file in the document root directory, I guess you have no chance to get your rules working correctly.
Gumbo
1st .htaccess file in / folder ; 2nd .htaccess file is in /myaddon folder . pls i did nt mean i cannot modify the 1st .htaccess in / , i mean its working well for main website. my prob is the .htaccess in /myaddonfolder
Ogugua Belonwu
@Ogugua Belonwu: I did understand you. But to determine whether .htaccess files in directories other than the document root directory are processed, you need to add the mentioned condition to have that rule only applied on that main host name and not the other domain.
Gumbo
i did add it and the main website stopped rewriting properly
Ogugua Belonwu
i did add RewriteCond %{HTTP_HOST} =www.mainwebsitename.com to d .htaccess in / folder
Ogugua Belonwu
A: 

I believe this is what your looking for:

Options -Multiviews

I use this in my root directory of domains hosted under my main domain and in my case they happen to be two levels deep.

i.e.

Options +FollowSymlinks

Options -Multiviews

RewriteEngine on

RewriteBase /

to clarify you add Options -Multiviews to the addon websites htaccess file. :D

Natrix
u are just an angel... it worked the page got displayed, bt the page couldnt access my css and pics anylonger. i hv my css in a folder inside the addon domain /css and pictures inside /pics. Pls wht do u think is the prob, thank you so much
Ogugua Belonwu
It seems as if it changes the directory structure cos when i click on link on the page it appears this way: http://www.myaddonwebsite.com/readjob/2/jobs/business-officer-eden-solutions-and-resources-ltd/index.php
Ogugua Belonwu
dont worry, tnks so muc problem solved, i used the base tag
Ogugua Belonwu
Hmm, Nitrix pls , i thought i solved the problem using the base tag, but now it affects all absolute links to external websites on the page, ow do i fix it
Ogugua Belonwu