/    Sign up×
Community /Pin to ProfileBookmark

mod_rewrite help

I’ve placed a file on my website, which is accessible at
[url]http://www.mydomain.tld/misc/seo_test/index.php[/url]

I want to configure my .htaccess in a way that if someone visit either of the following URLs

[url]http://www.mydomain.tld/misc/seo_test/[/url]
[url]http://www.mydomain.tld/misc/seo_test-abc/[/url]
[url]http://www.mydomain.tld/misc/seo_test-123/[/url]

server should read /misc/seo_test/index.php on each request.

I’ve placed .htaccess into /misc/seo_test directory with following code, which is not working at the moment..

[code]
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^misc/seo_test-(.*)$ /misc/seo_test/index.php
[/code]

Can you please fix this mod_rewrite code and also let me know if it’s ok to upload this .htaccess file into /misc/seo_test/ directory instead of placing it at ‘/’ (public_html)?

to post a comment
SEO

1 Comments(s)

Copy linkTweet thisAlerts:
@_lt_Eddie_gt_May 07.2006 — You're making life much harder for yourself doing things that way. Also, you're collecting variables and not doing anything with them. Try the following:

The page is:
<i>
</i>http://www.mydomain.tld/misc/seo_test/index.php
Preferred addresses are:
<i>
</i>http://www.mydomain.tld/misc/seo_test/
http://www.mydomain.tld/misc/seo_test/abc/
http://www.mydomain.tld/misc/seo_test/123/
These should relate to:
<i>
</i>http://www.mydomain.tld/misc/seo_test/index.php
http://www.mydomain.tld/misc/seo_test/index.php?test=abc
http://www.mydomain.tld/misc/seo_test/index.php?test=123
The [FONT=Courier New]mod_rewrite[/FONT] is:
<i>
</i>Options +FollowSymLinks
RewriteEngine on
RewriteRule misc/seo_test/(.*)/$ /misc/seo_test/index.php?test=$1
Oh, and it goes in the root which is your [FONT=Courier New]public_html[/FONT] folder.

If you get problems with it then the first point would be to fiddle with the relative paths you're calling as this is 99% of most errors.
×

Success!

Help @chuck59 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...