Note that there are some explanatory texts on larger screens.

plurals
  1. POMod_rewrite giving users own url, need to exclude some cases
    primarykey
    data
    text
    <p>I'm building a small local social good community website where every project has his own url, such that when username='foo' the URL becomes <a href="http://website.com/foo" rel="nofollow">http://website.com/foo</a> similar to Twitter. Even though I'm not experienced with htaccess I've managed to make it work to a large extent. However I am now running into problems when someone types in <a href="http://website.com/subdomain/foo" rel="nofollow">http://website.com/subdomain/foo</a>. This now also tries to find the username and display the page, but I don't want that to work and want to show them our 404 page.</p> <p>Also, on some subdomain's (i.e. about) we have other pages such as 'ourstory.php'. I'd really like to display 'about/ourstory' instead of about/ourstory.php, but only for selected subdomains.</p> <p>Finally, when having the structure 'website.com/subdomain/subdomain', it generates internal server errors when requiring other php files, even when absolute paths are used.</p> <p>Here is my current mod_rewrite, I hope you can understand what I try to do and feel free to optimize, I've probably made some beginner mistakes.</p> <p>This mod rewrite does three things:<br> 1. Remove 'www' infront of address;<br> 2. The second makes sure that when they just type the homepage, it takes them to the homepage(removing this, would result in an empty homepage for some reason, can this be done in another way?);<br> 3. When a name is typed that isn't a subdomain, it redirects them to the profile page and makes the url the username. </p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] &lt;/IfModule&gt; &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)/$ http://website.com/$1 [R=301,L] &lt;/IfModule&gt; &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$ RewriteRule ^(.{5,16})$ profile.php?scrname=$1 RewriteRule ^(.+)(\.php|\.html)/$ /$1$2 [R=301,L] &lt;/IfModule&gt; </code></pre> <p>Again, any help will be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload