Short URLs & Rewrite Rules

In order to enable short URL's with phpFox2 you will need mod_rewrite, most servers today have support for this. To enable this feature open the file on your server:

htaccess.txt

Look for:

RewriteBase /

If you have installed phpFox2 in a sub-folder you will need to change the trailing slash with the sub-folder path. For example if you installed your site on:

http://www.yoursite.com/folder/ 

You will need to change the RewriteBase to:

RewriteBase /folder/

If you installed your phpFox2 in your sites root directory (eg. http://www.yoursite.com ) you can leave this setting as it is.

Next lets rename the file

htaccess.txt

to

.htaccess

Once you have done that open the file

/include/setting/server.sett.php

and look for

$_CONF['core.url_rewrite'] = '2';

and replace that with

$_CONF['core.url_rewrite'] = '1';

By setting this to "1" this will transform your sites URLs from:

http://www.yoursite.com/index.php?do=/blog/title/ 

to

http://www.yoursite.com/blog/title/ 

Save and close the file. You should now have short url's enabled on your site.

Sub-Domain Short URLs (Beta)

We are currently testing rewriting URLs with wildcard sub-domains. In order to use this feature your server must support wildcard sub-domains. With this setup each of your users will have their own sub-domain. For example if we had a users profile using the short URL method like:

http://www.yoursite.com/username/ 

with this setup it would be:

http://username.yoursite.com/ 

Earlier we used a link to display how a blog would look with short URLs like:

http://www.yoursite.com/blog/title/ 

with this setup it would be:

http://blog.yoursite.com/title/ 

In order to set this up (assuming you have already followed the instructions above to install short URLs) open the file:

include/setting/server.sett.php

look for:

$_CONF['core.url_rewrite'] = '1';

replace with:

$_CONF['core.url_rewrite'] = '3';

Next, open the file:

.htaccess

Look for:

RewriteBase /

Under that add:

RewriteCond %{HTTP_HOST} ^admincp.example.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php?do=/$1

Notice where we have:

example.com

Change that to your host name. Note this is not the full path to where your site is installed, this is just your host name.

In some environments you may need to add the sections as subdomains, if this does not work out of the box please consult with your hosting company.


Comments
Only verified clients can post comments on our community. If you have any questions feel free to contact us here.
vern wrote at January 16, 2012, 2:25 am
0 Votes

Rewrite "3" tutorial is still need more improvement.i use "1" because "3" is make my site not working properly

vern
sundae wrote at January 8, 2012, 9:20 pm
0 Votes

can't upload photo or video at wall (feed) phpfoxV3 . rewrite "3"

Last Update on January 8, 2012, 9:20 pm by sundae
sundae
GanjaSmoke wrote at January 3, 2012, 11:37 am
0 Votes

Not my favorite tutorial.

Once you set $_CONF['core.url_rewrite'] = '1'; there is no going back afaik.

Setting it back doesn't reverse the changes. Would have been useful info.

Here is how I got it working (Hostgator):

added this:

Options +FollowSymlinks
RewriteEngine on

and got rid of the "admincp" in ^admincp.example.com$


Here was my final .htaccess add:


Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^ganja-smoke.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php?do=/$1

Last Update on January 3, 2012, 11:39 am by GanjaSmoke
GanjaSmoke
data66 wrote at January 13, 2012, 9:31 pm
0 Votes

I have had no issue changing back from short urls to long urls.

data66
vern wrote at December 20, 2011, 11:52 pm
0 Votes

SubDomain Sort Urls make V3 button not work, when mouse over the button like facebook connect,create ads,post status and etc the button not going to anywhere?

vern
asdasd wrote at December 10, 2011, 9:42 am
0 Votes
Quote:
In order to enable short URL's with phpFox2 you will need mod_rewrite, most servers today have support for this. To enable this feature open the file on your server:


I do not know what this means is that v3 has been used or not? But I will not venture because we are developing. This easily leads to other errors. So I hope to receive help and the new version and a shortened link can. To assist the work can easily operate.
Body!
Luckyboy123
asdasd
ceeme.in wrote at December 5, 2011, 8:20 pm
0 Votes

Hi,
I have a problem with my V3RC3 version, iam unable to use either of the metjods mentioned above.
It is giving me Page not found and 404 errors respectively.
can anyone tell me what is the problem.
Thanks

ceeme.in
vern wrote at December 3, 2011, 8:19 pm
0 Votes

i have this problem when i use Subdomain Url [Beta] on V3 RC3
error message "The page you are looking for cannot be found." when i type domain without www. but no problem when type domain with www.
please help!
Thank you

Last Update on December 3, 2011, 8:19 pm by vern
vern
Ferdi wrote at October 9, 2011, 6:38 pm
0 Votes

When I try Sub-Domain Short URLs (Beta) on V3 beta 3

I get this:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@ecachockeyzone.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.


------------------------------------------------------------ --------------------

Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at ecachockeyzone.com Port 80

Last Update on October 9, 2011, 6:52 pm by Jamie
Ferdi
Seanstex wrote at September 8, 2011, 7:13 am
0 Votes

Try this guys, in the .htaccess file don't change RewriteBase / to RewriteBase /folder/ (folder being your dev site name)

I have my site set up like this http://mysite.com/phpfoxdev

Being that my dev site is installed into a directory of my root(public_html) called phpfoxdev it has an .htaccess file, being that it's installed in that directory adding /folder/ makes it think it's two directories deep like so:

http://yoursite.com/phpfoxdev/phpfoxdev/

just leave the RewriteBase / alone, follow the rest of the instructions and it should work for V3.

This is what I done and it works just fine now.

Seanstex
data66 wrote at October 9, 2011, 7:43 pm
0 Votes

I have not had a problem and my site is a dev site too and I did it the way the instructions state. I am thinking maybe it's a server issue then since it works on my site http://mysite.com/phpfoxdev/ with the standard instructions.

data66
sundae wrote at September 17, 2011, 8:16 pm
0 Votes

at v3 beta2 I cant logout at homepage, stil showing homepage but otherpage islogout.

Last Update on September 17, 2011, 8:17 pm by odevanty
sundae
Tranceup wrote at September 2, 2011, 9:14 am
0 Votes

before my Short URLs & Rewrite Rules is working but now i have 404 Not found error to all my link. ANY IDEA?

Tranceup
Displaying 1 to 10 of 29