?
Solved

Mod_rewrite to a different folder

Posted on 2010-03-24
9
Medium Priority
?
295 Views
Last Modified: 2012-05-09
Hi i want to be able to mod_rewrite the path to a forum in my htaccess-file.

The forum software originally is in http://www.mydomain.com/etc/forum/
But I want to be able to call the forum like this: http://www.mydomain.com/forum/

So basically it means creating a symlink, in order to skip a folder.
How can this be accomplished?
0
Comment
Question by:Phila007
  • 6
  • 2
9 Comments
 
LVL 1

Expert Comment

by:rscarvalho
ID: 28451455
RewriteBase /
RewriteRule /etc/forum(/.*)? - [L]
RewriteRule /forum(/.*) /etc/forum/$1 [QSA,L]
0
 

Author Comment

by:Phila007
ID: 28452665
Hmm... doesn't work... file not found! But the content is in that folder...

I've found a way though (which works but not quite to my satisfaction:

RewriteRule ^forum(.*) /etc/forum$1 [L]

this works if I call the URL http://www.mydomain.com/forum/
but not if I call it without tha last slash: http://www.mydomain.com/forum
0
 
LVL 1

Expert Comment

by:rscarvalho
ID: 28453007
Try this:

RewriteRule /forum /etc/forum [QSA,L]
RewriteRule /forum/(.*) /etc/forum/$1 [QSA,L]
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:Phila007
ID: 28453230
Nope, now it doesn't even work both ways...
0
 

Author Comment

by:Phila007
ID: 28660512
Anyone?
0
 
LVL 2

Accepted Solution

by:
svenarild earned 1000 total points
ID: 29032390
Give this a try:

RewriteEngine on

RewriteRule ^forum$ etc/forum/ [L]
RewriteRule ^forum/(.*)$ etc/forum/$1 [L]
0
 

Author Comment

by:Phila007
ID: 29060219
Nope. Both don't work. Either with or without the slash it doesn't work.
0
 

Author Comment

by:Phila007
ID: 29060304
This one is still the best bet:

RewriteRule ^forum(.*) /etc/forum$1 [L]

I just need one to work without the slash now!
0
 

Author Closing Comment

by:Phila007
ID: 31706551
Sory my fault. This one works! I actually had another conflicting rule.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
By following these Magento e-commerce development tips, you can increase your website's conversion and profitability. Read this post for more details.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question