@hginli It won't remove "index.php?p=/" part from the urls, but will allow not to use it, i.e. "http://myforum.com/discussions" will work beside "http://myforum.com/index.php?p=discussions". And you have wrong slash direction at the last line. It should be "index.php/?p=$1". Also if forum reside in subdirectory "forumsubdir", you need to add "RewriteBase /forumsubdir/" after "RewriteEngine On". And this method will work only with Apache. For Nginx and Lighttpd you'll have to do something else.
EDIT: Vanilla 2 actually has an option to enable friendly URLs, after digging through config file I was able to find it. Edit conf/config.php and add $Configuration['Garden']['RewriteUrls'] = TRUE; and it'll work.
@sammyman, You need to make sure your server configuration supports url rewriting properly which means that your .htaccess file has to be configured to your specific server. If you are on nginx there are other posts on this forum to help you out.
If you don't have friendly urls after an install then most-likely you need to configure something. The install routine does a check to see if it can support friendly urls.
Once everything is configured correctly you can make sure by removing index.php?p= in your browser manually and making sure the correct pages are displayed. don't just do this on /discussions.
Once everything is working so what @fuwaneko did and edit conf/config.php and add
The long and the short of it is that friendly urls is the most difficult feature to get to work across the wide range of servers our there. We do a simple check to see if they are supported on install, and if that check fails we turn them off.
It's possible that the check fails, but friendly urls are still supported. It's also possible that a simple change to the htaccess file also works.
The thing is, if we disable friendly urls, but the server supports them then the site still works. If we enable friendly urls, but the server doesn't support them then the site is pooched (that's a technical term by-the-way).
There may be things we can do to make the tests better, but I think most of our work is going to have to be done with documentation.
I have moved my installation to / instead of /upsc. That fixes all my woes except broken links from other websites. Guess Google will index me with the new set up and update the search result links.
Comments
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
hope can help you ^^
EDIT: Vanilla 2 actually has an option to enable friendly URLs, after digging through config file I was able to find it.
Edit conf/config.php and add $Configuration['Garden']['RewriteUrls'] = TRUE; and it'll work.
/ and \ can use?
If you don't have friendly urls after an install then most-likely you need to configure something. The install routine does a check to see if it can support friendly urls.
Once everything is configured correctly you can make sure by removing index.php?p= in your browser manually and making sure the correct pages are displayed. don't just do this on /discussions.
Once everything is working so what @fuwaneko did and edit conf/config.php and add
It's possible that the check fails, but friendly urls are still supported. It's also possible that a simple change to the htaccess file also works.
The thing is, if we disable friendly urls, but the server supports them then the site still works. If we enable friendly urls, but the server doesn't support them then the site is pooched (that's a technical term by-the-way).
There may be things we can do to make the tests better, but I think most of our work is going to have to be done with documentation.
Okay, here is the thing. I have recently moved hosting. I am told URL rewrite option in ON by default.
On my previous hosting, I had managed to remove
index.php?p=
from all URLs on my forum. I had done so by simply:-$Configuration['Garden']['RewriteUrls'] = TRUE;
All my links were prettyURLs
Now in my new installation, I am told URL rewrite option in ON by default.
RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ RewriteCond %{REQUEST_URI} !^/upsc/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /upsc/$1 RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ RewriteRule ^(/)?$ upsc/index.php?p=/ [L]
I haven't enabled RewriteURL in config.php (if I do, it gives me a 404 error)
When I type
mydomain.com/upsc/discussions
It throws up a 404 error. It only works when I typemydomain.com/upsc/index.php?=/discussions
.Because of this, all the previous prettyURL links to my website and even google search results are broken.
What am i missing? :-(
@Lincoln @422 Can you point me in the right direction?
I want my website's default URL to be
mydomain.com/upsc
as it was that way on my previous hosting.If you are installed in the upsc folder then try just using the default .htaccess that comes with Vanilla.
Thanks for the reply!
That does help a bit. Could you tell me what I would need to do if I wanted my URL to be
mydomain.com/upsc
instead ofmydomain.com
And
mydomain.com/upsc/discussions
is desired instead ofmydomain.com/discussions
?Any change in .htaccess?
Because thats how my URL is linked from other places. changing mydomain.com/upsc to mydomain.com would break those links.
A quick reply would be helpful
Thanks @Todd
I have moved my installation to / instead of /upsc. That fixes all my woes except broken links from other websites. Guess Google will index me with the new set up and update the search result links.
At least I have prettyURLs now.
maybe these will help.
http://vanillaforums.org/discussion/comment/155310/#Comment_155310
http://vanillaforums.org/discussion/comment/163726/#Comment_163726
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
How to change my url
http://newsnetworkchannel.com/index.php?url=2015/08/freshers-interactive-intelligence-hiring-software-engineer.html
to
http://newsnetworkchannel.com/2015/08/freshers-interactive-intelligence-hiring-software-engineer.html
Please help me on this.
the answer was given 8 years ago and was already part of the core. If you read the discussion you commented on you wouldn't be asking.
grep is your friend.